Search in sources :

Example 26 with Http2Connection

use of io.netty.handler.codec.http2.Http2Connection in project zuul by Netflix.

the class Http2OrHttpHandler method configureHttp2.

private void configureHttp2(ChannelPipeline pipeline) {
    // setup the initial stream settings for the server to use.
    Http2Settings settings = new Http2Settings().maxConcurrentStreams(maxConcurrentStreams).initialWindowSize(initialWindowSize).headerTableSize(maxHeaderTableSize).maxHeaderListSize(maxHeaderListSize);
    Http2FrameCodec frameCodec = Http2FrameCodecBuilder.forServer().frameLogger(FRAME_LOGGER).initialSettings(settings).validateHeaders(true).build();
    Http2Connection conn = frameCodec.connection();
    // Use the uniform byte distributor until https://github.com/netty/netty/issues/10525 is fixed.
    conn.remote().flowController(new DefaultHttp2RemoteFlowController(conn, new UniformStreamByteDistributor(conn)));
    Http2MultiplexHandler multiplexHandler = new Http2MultiplexHandler(http2StreamHandler);
    // The frame codec MUST be in the pipeline.
    pipeline.addBefore("codec_placeholder", /* name= */
    null, frameCodec);
    pipeline.replace("codec_placeholder", HTTP_CODEC_HANDLER_NAME, multiplexHandler);
}
Also used : Http2MultiplexHandler(io.netty.handler.codec.http2.Http2MultiplexHandler) Http2Connection(io.netty.handler.codec.http2.Http2Connection) DefaultHttp2RemoteFlowController(io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController) Http2Settings(io.netty.handler.codec.http2.Http2Settings) Http2FrameCodec(io.netty.handler.codec.http2.Http2FrameCodec) UniformStreamByteDistributor(io.netty.handler.codec.http2.UniformStreamByteDistributor)

Aggregations

Http2Connection (io.netty.handler.codec.http2.Http2Connection)19 DefaultHttp2Connection (io.netty.handler.codec.http2.DefaultHttp2Connection)14 Http2ConnectionDecoder (io.netty.handler.codec.http2.Http2ConnectionDecoder)8 Http2Settings (io.netty.handler.codec.http2.Http2Settings)8 DefaultHttp2ConnectionEncoder (io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder)7 Http2ConnectionEncoder (io.netty.handler.codec.http2.Http2ConnectionEncoder)6 DefaultHttp2ConnectionDecoder (io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder)5 DefaultHttp2FrameReader (io.netty.handler.codec.http2.DefaultHttp2FrameReader)5 Http2Stream (io.netty.handler.codec.http2.Http2Stream)5 Bootstrap (io.netty.bootstrap.Bootstrap)4 Channel (io.netty.channel.Channel)4 ChannelFuture (io.netty.channel.ChannelFuture)4 ChannelPipeline (io.netty.channel.ChannelPipeline)4 DefaultHttp2FrameWriter (io.netty.handler.codec.http2.DefaultHttp2FrameWriter)4 VisibleForTesting (com.google.common.annotations.VisibleForTesting)3 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)3 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)3 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)3 DefaultHttp2LocalFlowController (io.netty.handler.codec.http2.DefaultHttp2LocalFlowController)3 Http2ConnectionHandler (io.netty.handler.codec.http2.Http2ConnectionHandler)3