io.netty.channel.socket.SocketChannel.newPromise()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(198)

本文整理了Java中io.netty.channel.socket.SocketChannel.newPromise()方法的一些代码示例,展示了SocketChannel.newPromise()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SocketChannel.newPromise()方法的具体详情如下:
包路径:io.netty.channel.socket.SocketChannel
类名称:SocketChannel
方法名:newPromise

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

相关文章