@Override public void initChannel(SocketChannel ch) { ChannelPipeline p = ch.pipeline(); ch.config().setAllocator(NettyChannelContext.ALLOCATOR); ch.config().setSendBufferSize(NettyChannelContext.BUFFER_SIZE); ch.config().setReceiveBufferSize(NettyChannelContext.BUFFER_SIZE); if (this.pool.getSSLContext() != null) { SSLEngine engine = this.pool.getSSLContext().createSSLEngine(); engine.setUseClientMode(true); p.addLast(SSL_HANDLER, new SslHandler(engine)); } p.addLast(ENCODER_HANDLER, new HttpRequestEncoder()); p.addLast(DECODER_HANDLER, new HttpResponseDecoder( NettyChannelContext.MAX_INITIAL_LINE_LENGTH, NettyChannelContext.MAX_HEADER_SIZE, NettyChannelContext.MAX_CHUNK_SIZE, false)); p.addLast(AGGREGATOR_HANDLER, new HttpObjectAggregator(SocketContext.getMaxRequestSize())); p.addLast(DCP_HANDLER, new NettyHttpServerResponseHandler(this.pool)); } }
ChannelPipeline p = ch.pipeline(); ch.config().setAllocator(NettyChannelContext.ALLOCATOR); ch.config().setSendBufferSize(NettyChannelContext.BUFFER_SIZE); ch.config().setReceiveBufferSize(NettyChannelContext.BUFFER_SIZE); if (this.sslContext != null) {
ChannelPipeline p = ch.pipeline(); ch.config().setAllocator(NettyChannelContext.ALLOCATOR); ch.config().setSendBufferSize(NettyChannelContext.BUFFER_SIZE); ch.config().setReceiveBufferSize(NettyChannelContext.BUFFER_SIZE); ChannelPromise settingsPromise = ch.newPromise();
ChannelPipeline p = ch.pipeline(); ch.config().setAllocator(NettyChannelContext.ALLOCATOR); ch.config().setSendBufferSize(NettyChannelContext.BUFFER_SIZE); ch.config().setReceiveBufferSize(NettyChannelContext.BUFFER_SIZE);
SocketChannelConfig config = ch.config(); config.setReceiveBufferSize(options.rcvbuf()); config.setSendBufferSize(options.sndbuf()); config.setKeepAlive(options.keepAlive()); config.setReuseAddress(options.reuseAddr());
SocketChannelConfig config = ch.config(); config.setReceiveBufferSize(options.rcvbuf()); config.setSendBufferSize(options.sndbuf()); config.setKeepAlive(options.keepAlive()); config.setReuseAddress(options.reuseAddr());
@Override public void initChannel(final SocketChannel ch) throws Exception { if(nettyOptions != null) { SocketChannelConfig config = ch.config(); config.setReceiveBufferSize(nettyOptions.rcvbuf()); config.setSendBufferSize(nettyOptions.sndbuf()); config.setKeepAlive(nettyOptions.keepAlive()); config.setReuseAddress(nettyOptions.reuseAddr()); config.setSoLinger(nettyOptions.linger()); config.setTcpNoDelay(nettyOptions.tcpNoDelay()); } if (log.isDebugEnabled()) { log.debug("CONNECT {}", ch); } if (null != getSslOptions()) { SSLEngine ssl = new SSLEngineSupplier(getSslOptions(), false).get(); if (log.isDebugEnabled()) { log.debug("SSL enabled using keystore {}", (null != getSslOptions().keystoreFile() ? getSslOptions().keystoreFile() : "<DEFAULT>")); } ch.pipeline().addLast(new SslHandler(ssl)); } if (null != nettyOptions && null != nettyOptions.pipelineConfigurer()) { nettyOptions.pipelineConfigurer().accept(ch.pipeline()); } bindChannel(handler, ch); } });