@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); } }
private Http2ConnectionHandler newHttp2ConnectionHandler(final ChannelPipeline p) { DefaultHttp2Connection connection = new DefaultHttp2Connection(true); InboundHttp2ToHttpAdapter listener = new InboundHttp2ToHttpAdapterBuilder(connection) .propagateSettings(false) .validateHttpHeaders(false) .maxContentLength(maxContentLength) .build(); HttpToHttp2ConnectionHandler http2handler = new HttpToHttp2ConnectionHandlerBuilder() .frameListener(listener) .frameLogger(new Http2FrameLogger(LogLevel.DEBUG)) .connection(connection) .build(); return http2handler; }
@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(); }
private static void configureHttp2(ChannelHandlerContext ctx) { DefaultHttp2Connection connection = new DefaultHttp2Connection(true); InboundHttp2ToHttpAdapter listener = new InboundHttp2ToHttpAdapterBuilder(connection) .propagateSettings(true).validateHttpHeaders(false) .maxContentLength(MAX_CONTENT_LENGTH).build(); ctx.pipeline().addLast(new HttpToHttp2ConnectionHandlerBuilder() .frameListener(listener) // .frameLogger(TilesHttp2ToHttpHandler.logger) .connection(connection).build()); ctx.pipeline().addLast(new Http2RequestHandler()); }