配置Netty SSL客户端套接字以在Android中发送SNI标头

时间:2016-09-12 15:11:35

标签: sockets ssl netty sni

我想使用Netty框架创建SSL / TLS连接,该框架将在握手期间一起发送SNI标头。我目前的代码如下:

创建SslContext:

    TrustManagerFactory trustManagerFactory = SimpleTrustManagerFactory.getInstance(
            SimpleTrustManagerFactory.getDefaultAlgorithm());
    trustManagerFactory.init((KeyStore)null);

    sslContext = SslContextBuilder
            .forClient()
            .sslProvider(SslProvider.JDK)
            // TODO p0: Ensure all the versions we support have this algorithm installed
            .trustManager(trustManagerFactory)
            .build();

然后在管道创建期间:

    pipeline.addLast(sslContext.newHandler(ch.alloc(), cloud.getHostName(), cloud.getPort()));

但是不发送SNI标头。什么是迫使Netty在SSL客户端握手中提供SNI?

0 个答案:

没有答案