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

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

Introduction

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

Prototype

protected HttpToHttp2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
            Http2Settings initialSettings, boolean validateHeaders) 

Source Link

Usage

From source file:jmeter.plugins.http2.sampler.Http2ClientInitializer.java

License:Apache License

@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);/*from w  w  w  .  j  av  a2  s .  c o m*/
    } else {
        configureClearText(ch);
    }
}

From source file:netty.mmb.http2.Client.Http2ClientInitializer.java

License:Apache License

@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());
    if (sslCtx != null) {
        configureSsl(ch);/*w w w .ja  va2s.  co  m*/
    } else {
        configureClearText(ch);
    }
}

From source file:org.apache.hadoop.hdfs.server.datanode.web.dtp.TestDtpHttp2.java

License:Apache License

@BeforeClass
public static void setUp() throws IOException, URISyntaxException, TimeoutException {
    CLUSTER = new MiniDFSCluster.Builder(CONF).numDataNodes(1).build();
    CLUSTER.waitActive();//ww w.  jav a  2s. c o  m

    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();

}