@Override public void handlerAdded(ChannelHandlerContext ctx) throws Exception { LOGGER.info("{} : handlerAdded", connectionInfo); Http2Connection connection = new DefaultHttp2Connection(true); ChannelHandler http2ConnHandler = new HttpToHttp2ConnectionHandlerBuilder() .frameListener(new DelegatingDecompressorFrameListener( connection, new InboundHttp2ToHttpAdapterBuilder(connection) .maxContentLength(master.config().getMaxContentLength()) .propagateSettings(true) .build())) .connection(connection) .frameLogger(new Http2FrameLogger(LogLevel.DEBUG)) .build(); ctx.pipeline() .addBefore(ctx.name(), null, http2ConnHandler) .addBefore(ctx.name(), null, new Http2Handler()); }
@Override public void handlerAdded(ChannelHandlerContext ctx) throws Exception { LOGGER.info("{} : handlerAdded", connectionInfo); Http2Connection connection = new DefaultHttp2Connection(false); ChannelHandler http2ConnHandler = new HttpToHttp2ConnectionHandlerBuilder() .frameListener(new DelegatingDecompressorFrameListener( connection, new InboundHttp2ToHttpAdapterBuilder(connection) .maxContentLength(master.config().getMaxContentLength()) .propagateSettings(true) .build())) .frameLogger(new Http2FrameLogger(LogLevel.DEBUG)) .connection(connection) .build(); ctx.pipeline() .addBefore(ctx.name(), null, http2ConnHandler) .addBefore(ctx.name(), null, new Http2Handler()); }
@Override public void initChannel(SocketChannel ch) throws Exception { final Http2Connection connection = new DefaultHttp2Connection(false); connectionHandler = new HttpToHttp2ConnectionHandlerBuilder() .frameListener(new DelegatingDecompressorFrameListener( connection, new InboundHttp2ToHttpAdapterBuilder(connection) .maxContentLength(maxContentLength) .propagateSettings(true) .build())) .frameLogger(logger) .connection(connection) .build(); responseHandler = new HttpResponseHandler(); settingsHandler = new Http2SettingsHandler(ch.newPromise()); if (sslCtx != null) { configureSsl(ch); } else { configureClearText(ch); } }
@Override public void initChannel(SocketChannel ch) throws Exception { final Http2Connection connection = new DefaultHttp2Connection(false); final Http2FrameWriter frameWriter = frameWriter(); connectionHandler = new HttpToHttp2ConnectionHandler(connection, frameReader(), frameWriter, new DelegatingDecompressorFrameListener(connection, new InboundHttp2ToHttpAdapter.Builder(connection) .maxContentLength(maxContentLength) .propagateSettings(true) .build())); responseHandler = new HttpResponseHandler(); settingsHandler = new Http2SettingsHandler(ch.newPromise()); configureClearText(ch); }
@Override public void initChannel(SocketChannel ch) throws Exception { final Http2Connection connection = new DefaultHttp2Connection(false); connectionHandler = new HttpToHttp2ConnectionHandler(connection, frameReader(), frameWriter(), new DelegatingDecompressorFrameListener(connection, new InboundHttp2ToHttpAdapter.Builder(connection) .maxContentLength(maxContentLength) .propagateSettings(true) .build())); responseHandler = new HttpResponseHandler(); settingsHandler = new Http2SettingsHandler(ch.newPromise()); if (sslCtx != null) { configureSsl(ch); } else { configureClearText(ch); } }
@Override public void initChannel(SocketChannel ch) throws Exception { final Http2Connection connection = new DefaultHttp2Connection(false); connectionHandler = new HttpToHttp2ConnectionHandlerBuilder() .frameListener(new DelegatingDecompressorFrameListener( connection, new InboundHttp2ToHttpAdapterBuilder(connection) .maxContentLength(maxContentLength) .propagateSettings(true) .build())) .frameLogger(logger) .connection(connection) .build(); responseHandler = new HTTP2ResponseHandler(); settingsHandler = new HTTP2SettingsHandler(ch.newPromise()); if (sslCtx != null) { configureSsl(ch); } else { configureClearText(ch); } }
@BeforeClass public static void setUp() throws IOException, URISyntaxException, TimeoutException { CLUSTER = new MiniDFSCluster.Builder(CONF).numDataNodes(1).build(); CLUSTER.waitActive(); RESPONSE_HANDLER = new Http2ResponseHandler(); Bootstrap bootstrap = new Bootstrap() .group(WORKER_GROUP) .channel(NioSocketChannel.class) .remoteAddress("127.0.0.1", CLUSTER.getDataNodes().get(0).getInfoPort()) .handler(new ChannelInitializer<Channel>() { @Override protected void initChannel(Channel ch) throws Exception { Http2Connection connection = new DefaultHttp2Connection(false); Http2ConnectionHandler connectionHandler = new HttpToHttp2ConnectionHandler(connection, frameReader(), frameWriter(), new DelegatingDecompressorFrameListener( connection, new InboundHttp2ToHttpAdapter.Builder( connection).maxContentLength(Integer.MAX_VALUE) .propagateSettings(true).build())); ch.pipeline().addLast(connectionHandler, RESPONSE_HANDLER); } }); CHANNEL = bootstrap.connect().syncUninterruptibly().channel(); }
@Override public void initChannel(SocketChannel ch) throws Exception { final ChannelPipeline p = ch.pipeline(); final Http2Connection conn = new DefaultHttp2Connection(false); final HttpToHttp2ConnectionHandler connHandler = new HttpToHttp2ConnectionHandlerBuilder() .connection(conn) .frameListener(new DelegatingDecompressorFrameListener( conn, new InboundHttp2ToHttpAdapterBuilder(conn) .maxContentLength(Integer.MAX_VALUE) .propagateSettings(true).build())) .build(); clientHandler = new THttp2ClientHandler(ch.eventLoop()); if (sslCtx != null) { p.addLast(sslCtx.newHandler(p.channel().alloc())); p.addLast(connHandler); configureEndOfPipeline(p); } else { Http1ClientCodec sourceCodec = new Http1ClientCodec(); HttpClientUpgradeHandler upgradeHandler = new HttpClientUpgradeHandler( sourceCodec, new Http2ClientUpgradeCodec(connHandler), 65536); p.addLast(sourceCodec, upgradeHandler, new UpgradeRequestHandler()); } }