Search in sources :

Example 1 with UnsupportedHandler

use of com.linkedin.r2.netty.handler.http2.UnsupportedHandler in project rest.li by linkedin.

the class Http2ChannelInitializer method configureClearText.

/**
 * Configure the pipeline for HTTP/2 clear text.
 */
private void configureClearText(NioSocketChannel channel) {
    final HttpClientCodec sourceCodec = new HttpClientCodec(_maxInitialLineLength, _maxHeaderSize, _maxChunkSize);
    UnsupportedHandler unsupportedHandler = new UnsupportedHandler();
    Http2MultiplexHandler multiplexHandler = new Http2MultiplexHandler(unsupportedHandler, unsupportedHandler);
    Http2ClientUpgradeCodec upgradeCodec = new Http2ClientUpgradeCodec((Http2ConnectionHandler) Http2FrameCodecBuilder.forClient().initialSettings(createHttp2Settings()).build(), multiplexHandler);
    final ChannelPromise upgradePromise = channel.newPromise();
    channel.attr(NettyChannelAttributes.INITIALIZATION_FUTURE).set(upgradePromise);
    channel.pipeline().addLast(sourceCodec);
    channel.pipeline().addLast(new HttpClientUpgradeHandler(sourceCodec, upgradeCodec, _maxContentLength));
    channel.pipeline().addLast(new Http2ProtocolUpgradeHandler(upgradePromise));
}
Also used : UnsupportedHandler(com.linkedin.r2.netty.handler.http2.UnsupportedHandler) Http2MultiplexHandler(io.netty.handler.codec.http2.Http2MultiplexHandler) Http2ProtocolUpgradeHandler(com.linkedin.r2.netty.handler.http2.Http2ProtocolUpgradeHandler) Http2ClientUpgradeCodec(io.netty.handler.codec.http2.Http2ClientUpgradeCodec) ChannelPromise(io.netty.channel.ChannelPromise) HttpClientCodec(io.netty.handler.codec.http.HttpClientCodec) HttpClientUpgradeHandler(io.netty.handler.codec.http.HttpClientUpgradeHandler)

Aggregations

Http2ProtocolUpgradeHandler (com.linkedin.r2.netty.handler.http2.Http2ProtocolUpgradeHandler)1 UnsupportedHandler (com.linkedin.r2.netty.handler.http2.UnsupportedHandler)1 ChannelPromise (io.netty.channel.ChannelPromise)1 HttpClientCodec (io.netty.handler.codec.http.HttpClientCodec)1 HttpClientUpgradeHandler (io.netty.handler.codec.http.HttpClientUpgradeHandler)1 Http2ClientUpgradeCodec (io.netty.handler.codec.http2.Http2ClientUpgradeCodec)1 Http2MultiplexHandler (io.netty.handler.codec.http2.Http2MultiplexHandler)1