mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jianbao (Jim) Tao" <jianbao....@gmail.com>
Subject How to force SslFilter to use sslContext.createSSLEngine(peer.getHostName(), peer.getPort())
Date Sun, 19 Apr 2015 16:36:24 GMT

I have a use case where I need to connect to a remote server that requires
SNI. I am using mina version 2.0.0-M6.

In org.apache.mina.filter.ssl.SslHandler, I see this code:

        InetSocketAddress peer = (InetSocketAddress) session

        // Create the SSL engine here
        if (peer == null) {
            sslEngine = sslContext.createSSLEngine();
        } else {
            sslEngine = sslContext.createSSLEngine(peer.getHostName(),

However, the problem is, I don't know how to add SslFilter.PEER_ADDRESS
attribute so that it will be available when SslHandler creates sslEngine.

This is how I connect to the remote server:
        ExecutorService connectorPool = Executors.newFixedThreadPool(20);
        NioProcessor connectorProcessor = new NioProcessor(connectorPool);
        NioSocketConnector connector = new
NioSocketConnector(connectorPool, connectorProcessor);
        connector.setHandler(new DummyIoHandler());

                new ProtocolCodecFilter(new HttpCodecFactory()));

        SSLConnectorFilter sslConnectorFilter = new SSLConnectorFilter();
// extends SslFilter and wraps a custom SSLContext
        connector.getFilterChain().addFirst("ssl", sslConnectorFilter);

Thanks in advance for your help.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message