public void connectRequested(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { InetSocketAddress remoteInetSocketAddress = (InetSocketAddress) e.getValue(); String peerHost = remoteInetSocketAddress.getHostString(); int peerPort = remoteInetSocketAddress.getPort(); SslHandler sslHandler = channelManager.createSslHandler(peerHost, peerPort); ctx.getPipeline().replace(ChannelManager.SSL_HANDLER, ChannelManager.SSL_HANDLER, sslHandler); ctx.sendDownstream(e); } }
public void upgradeProtocol(ChannelPipeline pipeline, String scheme, String host, int port) throws IOException, GeneralSecurityException { if (pipeline.get(HTTP_HANDLER) != null) pipeline.remove(HTTP_HANDLER); if (isSecure(scheme)) if (isSslHandlerConfigured(pipeline)) { pipeline.addAfter(SSL_HANDLER, HTTP_HANDLER, newHttpClientCodec()); } else { pipeline.addFirst(HTTP_HANDLER, newHttpClientCodec()); pipeline.addFirst(SSL_HANDLER, createSslHandler(host, port)); } else pipeline.addFirst(HTTP_HANDLER, newHttpClientCodec()); if (isWebSocket(scheme)) { pipeline.addAfter(HTTP_PROCESSOR, WS_PROCESSOR, wsProcessor); pipeline.remove(HTTP_PROCESSOR); } }
public void connectRequested(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { InetSocketAddress remoteInetSocketAddress = (InetSocketAddress) e.getValue(); String peerHost = remoteInetSocketAddress.getHostName(); int peerPort = remoteInetSocketAddress.getPort(); SslHandler sslHandler = channelManager.createSslHandler(peerHost, peerPort); ctx.getPipeline().replace(ChannelManager.SSL_HANDLER, ChannelManager.SSL_HANDLER, sslHandler); ctx.sendDownstream(e); } }
public void upgradeProtocol(ChannelPipeline pipeline, String scheme, String host, int port) throws IOException, GeneralSecurityException { if (pipeline.get(HTTP_HANDLER) != null) pipeline.remove(HTTP_HANDLER); if (isSecure(scheme)) if (isSslHandlerConfigured(pipeline)){ pipeline.addAfter(SSL_HANDLER, HTTP_HANDLER, newHttpClientCodec()); } else { pipeline.addFirst(HTTP_HANDLER, newHttpClientCodec()); pipeline.addFirst(SSL_HANDLER, createSslHandler(host, port)); } else pipeline.addFirst(HTTP_HANDLER, newHttpClientCodec()); if (isWebSocket(scheme)) pipeline.replace(HTTP_PROCESSOR, WS_PROCESSOR, wsProcessor); }