@Override public void initChannel( SocketChannel ch ) throws Exception { ch.config().setAllocator( PooledByteBufAllocator.DEFAULT ); if( sslCtx != null ) { ch.pipeline().addLast( sslCtx.newHandler( ch.alloc() ) ); } ch.pipeline().addLast( new SocketTransportHandler( new SocketTransportHandler.ProtocolChooser( protocolVersions ), logging ) ); } } );
@Override public void initChannel( SocketChannel ch ) throws Exception { ch.config().setAllocator( PooledByteBufAllocator.DEFAULT ); if( sslCtx != null ) { ch.pipeline().addLast( sslCtx.newHandler( ch.alloc() ) ); } ch.pipeline().addLast( new HttpServerCodec(), new HttpObjectAggregator( MAX_WEBSOCKET_HANDSHAKE_SIZE ), new WebSocketServerProtocolHandler( "" ), new WebSocketFrameTranslator(), new SocketTransportHandler( new SocketTransportHandler.ProtocolChooser( availableVersions ), logging ) ); } } );
@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)); } }
@Override public void initChannel( SocketChannel ch ) throws Exception { try { ch.config().setOption( ChannelOption.IP_TOS, 0x18 ); } catch ( ChannelException e ) { // Ignore } ch.config().setAllocator( PooledByteBufAllocator.DEFAULT ); ch.config().setWriteBufferWaterMark( MARK ); Pipeline.prepare( ch.pipeline(), connectionHandler ); } }
@Override public void initChannel( SocketChannel ch ) throws Exception { final ConnectionHandler connectionHandler = new ConnectionHandler(); try { ch.config().setOption( ChannelOption.IP_TOS, 0x18 ); } catch ( ChannelException ex ) { // Ignored } ch.config().setAllocator( PooledByteBufAllocator.DEFAULT ); ch.config().setWriteBufferWaterMark( MARK ); Pipeline.prepare( ch.pipeline(), connectionHandler ); connectionHandler.whenConnected( aVoid -> newConnection.accept( connectionHandler ) ); } }
@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);
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);
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);