本文整理了Java中io.netty.channel.socket.SocketChannel.newPromise()
方法的一些代码示例,展示了SocketChannel.newPromise()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SocketChannel.newPromise()
方法的具体详情如下:
包路径:io.netty.channel.socket.SocketChannel
类名称:SocketChannel
方法名:newPromise
暂无
代码示例来源:origin: alipay/sofa-rpc
@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);
}
}
}
代码示例来源:origin: alipay/sofa-rpc
@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);
}
}
}
代码示例来源:origin: vmware/xenon
ch.config().setSendBufferSize(NettyChannelContext.BUFFER_SIZE);
ch.config().setReceiveBufferSize(NettyChannelContext.BUFFER_SIZE);
ChannelPromise settingsPromise = ch.newPromise();
ch.attr(NettyChannelContext.SETTINGS_PROMISE_KEY).set(settingsPromise);
代码示例来源:origin: com.alipay.sofa/sofa-rpc-all
@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);
}
}
}
代码示例来源:origin: fstab/http2-examples
@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);
}
}
代码示例来源:origin: org.infinispan/infinispan-server-rest
@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);
}
}
内容来源于网络,如有侵权,请联系作者删除!