Example usage for io.netty.handler.codec.http2 Http2Exception Http2Exception

List of usage examples for io.netty.handler.codec.http2 Http2Exception Http2Exception

Introduction

In this page you can find the example usage for io.netty.handler.codec.http2 Http2Exception Http2Exception.

Prototype

public Http2Exception(Http2Error error, String message, Throwable cause) 

Source Link

Usage

From source file:com.linecorp.armeria.common.http.AbstractHttpToHttp2ConnectionHandler.java

License:Apache License

@Override
protected void onConnectionError(ChannelHandlerContext ctx, Throwable cause, Http2Exception http2Ex) {
    if (handlingConnectionError) {
        return;//from   w  ww . ja v  a  2s  .c  om
    }

    handlingConnectionError = true;

    // TODO(trustin): Remove this once Http2ConnectionHandler.goAway() sends better debugData.
    //                See https://github.com/netty/netty/issues/5160
    if (http2Ex == null) {
        http2Ex = new Http2Exception(INTERNAL_ERROR, goAwayDebugData(null, cause), cause);
    } else if (http2Ex instanceof ClosedStreamCreationException) {
        final ClosedStreamCreationException e = (ClosedStreamCreationException) http2Ex;
        http2Ex = new ClosedStreamCreationException(e.error(), goAwayDebugData(e, cause), cause);
    } else {
        http2Ex = new Http2Exception(http2Ex.error(), goAwayDebugData(http2Ex, cause), cause,
                http2Ex.shutdownHint());
    }

    super.onConnectionError(ctx, cause, http2Ex);
}

From source file:com.linecorp.armeria.internal.AbstractHttp2ConnectionHandler.java

License:Apache License

@Override
protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound, Throwable cause,
        Http2Exception http2Ex) {
    if (handlingConnectionError) {
        return;//from  ww w.  ja  va 2s . c  om
    }

    handlingConnectionError = true;

    // TODO(trustin): Remove this once Http2ConnectionHandler.goAway() sends better debugData.
    //                See https://github.com/netty/netty/issues/5160
    if (http2Ex == null) {
        http2Ex = new Http2Exception(INTERNAL_ERROR, goAwayDebugData(null, cause), cause);
    } else if (http2Ex instanceof ClosedStreamCreationException) {
        final ClosedStreamCreationException e = (ClosedStreamCreationException) http2Ex;
        http2Ex = new ClosedStreamCreationException(e.error(), goAwayDebugData(e, cause), cause);
    } else {
        http2Ex = new Http2Exception(http2Ex.error(), goAwayDebugData(http2Ex, cause), cause,
                http2Ex.shutdownHint());
    }

    super.onConnectionError(ctx, outbound, cause, http2Ex);
}