io.netty.channel.socket.SocketChannel#newPromise ( )源码实例Demo

下面列出了io.netty.channel.socket.SocketChannel#newPromise ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netty-4.1.22   文件: Http2ClientInitializer.java
@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) {
    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);
    }
}
 
源代码3 项目: sofa-rpc   文件: Http2ClientInitializer.java
@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(transportConfig.getPayload()).propagateSettings(true).build()))
        .connection(connection).build();
    responseHandler = new Http2ClientChannelHandler();
    settingsHandler = new Http2SettingsHandler(ch.newPromise());
    String protocol = transportConfig.getProviderInfo().getProtocolType();
    if (RpcConstants.PROTOCOL_TYPE_H2.equals(protocol)) {
        configureSsl(ch);
    } else if (RpcConstants.PROTOCOL_TYPE_H2C.equals(protocol)) {
        if (!useH2cPriorKnowledge) {
            configureClearTextWithHttpUpgrade(ch);
        } else {
            configureClearTextWithPriorKnowledge(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);
    }
}
 
源代码5 项目: http2-examples   文件: Http2ClientInitializer.java
@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);
    } else {
        configureClearText(ch);
    }
}
 
源代码6 项目: netty-cookbook   文件: Http2ClientInitializer.java
@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);
}
 
源代码7 项目: tutorials   文件: Http2ClientInitializer.java
@Override
public void initChannel(SocketChannel ch) throws Exception {

    settingsHandler = new Http2SettingsHandler(ch.newPromise());
    responseHandler = new Http2ClientResponseHandler();
    
    if (sslCtx != null) {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(sslCtx.newHandler(ch.alloc(), host, port));
        pipeline.addLast(Http2Util.getClientAPNHandler(maxContentLength, settingsHandler, responseHandler));
    }
}