类io.netty.handler.ssl.SniHandler源码实例Demo

下面列出了怎么用io.netty.handler.ssl.SniHandler的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: nomulus   文件: SslClientInitializerTest.java
private ChannelHandler getServerHandler(
    boolean requireClientCert, PrivateKey privateKey, X509Certificate certificate)
    throws Exception {
  SslContext sslContext =
      SslContextBuilder.forServer(privateKey, certificate)
          .trustManager(InsecureTrustManagerFactory.INSTANCE)
          .clientAuth(requireClientCert ? ClientAuth.REQUIRE : ClientAuth.NONE)
          .build();
  return new SniHandler(
      hostname -> {
        sniHostReceived = hostname;
        return sslContext;
      });
}
 
源代码2 项目: servicetalk   文件: NettyPipelineSslUtils.java
/**
 * Determine if the {@link ChannelPipeline} is configured for SSL/TLS.
 *
 * @param pipeline The pipeline to check.
 * @return {@code true} if the pipeline is configured to use SSL/TLS.
 */
public static boolean isSslEnabled(ChannelPipeline pipeline) {
    return pipeline.get(SslHandler.class) != null || pipeline.get(SniHandler.class) != null;
}