private static SSLEngineFactory createSSLEngineFactory( final Configuration config, final boolean clientMode) throws Exception { final SSLContext sslContext = clientMode ? createSSLClientContext(config) : createSSLServerContext(config); checkState(sslContext != null, "%s it not enabled", SecurityOptions.SSL_ENABLED.key()); return new SSLEngineFactory( sslContext, getEnabledProtocols(config), getEnabledCipherSuites(config), clientMode); }
@Override protected void initChannel(SocketChannel socketChannel) { // SSL should be the first handler in the pipeline if (sslEngineFactory != null) { socketChannel.pipeline().addLast("ssl", new SslHandler(sslEngineFactory.createSSLEngine())); } socketChannel.pipeline() .addLast(new HttpClientCodec()) .addLast(new HttpObjectAggregator(configuration.getMaxContentLength())) .addLast(new ChunkedWriteHandler()) // required for multipart-requests .addLast(new ClientHandler()); } };
@Override protected void initChannel(SocketChannel ch) { Handler handler = new RouterHandler(router, responseHeaders); // SSL should be the first handler in the pipeline if (sslEngineFactory != null) { ch.pipeline().addLast("ssl", new SslHandler(sslEngineFactory.createSSLEngine())); } ch.pipeline() .addLast(new HttpServerCodec()) .addLast(new FileUploadHandler(uploadDir)) .addLast(new FlinkHttpObjectAggregator(maxContentLength, responseHeaders)) .addLast(new ChunkedWriteHandler()) .addLast(handler.name(), handler) .addLast(new PipelineErrorHandler(log, responseHeaders)); } };