@Override protected void initChannel(SocketChannel channel) throws Exception { configureChannel(channel.config()); ChannelPipeline pipeline = channel.pipeline(); if (isSecure) { Assert.notNull(sslContext, "sslContext should not be null"); pipeline.addLast(sslContext.newHandler(channel.alloc(), uri.getHost(), uri.getPort())); } pipeline.addLast(new HttpClientCodec()); pipeline.addLast(new HttpObjectAggregator(maxResponseSize)); if (readTimeout > 0) { pipeline.addLast(new ReadTimeoutHandler(readTimeout, TimeUnit.MILLISECONDS)); } } });
final ChannelPipeline p = channel.pipeline(); HttpContentDecompressor decompressor = p.get(HttpContentDecompressor.class); if (decompressor != null) { p.remove(decompressor); HttpObjectAggregator aggregator = p.get(HttpObjectAggregator.class); if (aggregator != null) { p.remove(aggregator); codec.removeOutboundHandler(); p.addAfter(ctx.name(), "ws-decoder", newWebsocketDecoder()); channel.eventLoop().execute(new Runnable() { @Override public void run() { channel.eventLoop().execute(new Runnable() { @Override public void run() {
public boolean isSingleDecode() { return inboundHandler().isSingleDecode(); }
@Override protected void initChannel(Channel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new HttpClientCodec()); pipeline.addLast(new HttpObjectAggregator(Integer.MAX_VALUE)); } }
@Override protected void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new HttpClientCodec()) .addLast(new HttpContentDecompressor()) .addLast(new HttpObjectAggregator(10048576)) .addLast(new ProxyChannelInboundHandler()); } });
@Override protected void initChannel(Channel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (isClient) { pipeline.addLast("codec", new HttpClientCodec()); pipeline.addLast("decompressor", new HttpContentDecompressor()); } else { pipeline.addLast("codec", new HttpServerCodec()); pipeline.addLast("compressor", new HttpContentCompressor()); } } }
@Override protected void initChannel(final SocketChannel channel) throws Exception { channel.pipeline().addLast(new HttpClientCodec()); channel.pipeline().addLast(new HttpContentDecompressor()); } });
@Override protected void initChannel(Channel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); SSLEngine engine = context.newEngine(ch.alloc()); pipeline.addFirst("ssl", new SslHandler(engine)); if (isClient) { pipeline.addLast("codec", new HttpClientCodec()); } else { pipeline.addLast("codec", new HttpServerCodec()); } } }
ChannelPipeline p = ch.pipeline(); ch.config().setAutoRead(false); SslHandler sslHandler = sslContext.newHandler( ch.alloc(), host, port ); p.addFirst(HANDLER_SSL, sslHandler); readTimeout.ifPresent(duration -> { if (!duration.isNegative()) { p.addLast(HANDLER_READ_TIMEOUT, new ReadTimeoutHandler(duration.toMillis(), TimeUnit.MILLISECONDS)); Duration duration = readIdleTime.get(); if (!duration.isNegative()) { p.addLast(HANDLER_IDLE_STATE, new IdleStateHandler(duration.toMillis(), duration.toMillis(), duration.toMillis(), TimeUnit.MILLISECONDS)); p.addLast(HANDLER_HTTP_CLIENT_CODEC, new HttpClientCodec()); p.addLast(HANDLER_DECODER, new HttpContentDecompressor());
@Override protected void initChannel(Channel ch) throws Exception { ch.pipeline().addLast( "timeout", new ReadTimeoutHandler( HttpClient.TIMEOUT, TimeUnit.MILLISECONDS ) ); if ( ssl ) { SSLEngine engine = SslContext.newClientContext().newEngine( ch.alloc(), host, port ); ch.pipeline().addLast( "ssl", new SslHandler( engine ) ); } ch.pipeline().addLast( "http", new HttpClientCodec() ); ch.pipeline().addLast( "handler", new HttpHandler( callback ) ); } }
@Override protected void initChannel(final UnixChannel channel) throws Exception { channel.pipeline().addLast(new HttpClientCodec()); channel.pipeline().addLast(new HttpContentDecompressor()); } });
@Override public void accept(ConnectionObserver listener, Channel channel) { channel.pipeline() .addLast(NettyPipeline.HttpCodec, new HttpClientCodec()); if (handler.compress) { channel.pipeline() .addAfter(NettyPipeline.HttpCodec, NettyPipeline.HttpDecompressor, new HttpContentDecompressor()); } }
private void configureHttp11(Channel ch, ChannelPipeline pipeline) { pipeline.addLast(new HttpClientCodec()); ch.attr(PROTOCOL_FUTURE).get().complete(Protocol.HTTP1_1); }
@Override public void configure(final ChannelPipeline pipeline) { final String scheme = connection.getUri().getScheme(); if (!"ws".equalsIgnoreCase(scheme) && !"wss".equalsIgnoreCase(scheme)) throw new IllegalStateException("Unsupported scheme (only ws: or wss: supported): " + scheme); if (!supportsSsl() && "wss".equalsIgnoreCase(scheme)) throw new IllegalStateException("To use wss scheme ensure that enableSsl is set to true in configuration"); final int maxContentLength = cluster.connectionPoolSettings().maxContentLength; handler = new WebSocketClientHandler( WebSocketClientHandshakerFactory.newHandshaker( connection.getUri(), WebSocketVersion.V13, null, false, EmptyHttpHeaders.INSTANCE, maxContentLength)); pipeline.addLast("http-codec", new HttpClientCodec()); pipeline.addLast("aggregator", new HttpObjectAggregator(maxContentLength)); pipeline.addLast("ws-handler", handler); pipeline.addLast("gremlin-encoder", webSocketGremlinRequestEncoder); pipeline.addLast("gremlin-decoder", webSocketGremlinResponseDecoder); }
ChannelHandlerContext chctx = soInt.channelHandlerContext(); ChannelPipeline pipeline = chctx.pipeline(); pipeline.addBefore("handler", "http", new HttpClientCodec()); AtomicInteger status = new AtomicInteger(); soInt.handler(buff -> fail());
private HttpClientCodec newHttpClientCodec() { return new HttpClientCodec(// config.getHttpClientCodecMaxInitialLineLength(), config.getHttpClientCodecMaxHeaderSize(), config.getHttpClientCodecMaxChunkSize(), false, config.isValidateResponseHeaders(), config.getHttpClientCodecInitialBufferSize()); }
@Override protected void removeEncoder(ChannelHandlerContext ctx) throws Exception { codec.removeOutboundHandler(); }
@Override public void initChannel(Channel channel) throws Exception { ChannelPipeline pipeline = channel.pipeline(); if (log.isDebugEnabled()) { pipeline.addLast(new LoggingHandler()); } if (sslContext != null) { pipeline.addLast("ssl", sslContext.newHandler(channel.alloc())); } pipeline.addLast("http-codec", new HttpClientCodec()); for (ChannelHandler handler : handlers) { pipeline.addLast(handler); } pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); } }
@Override protected void initChannel(final SocketChannel ch) { final ChannelPipeline p = ch.pipeline(); p.addLast( new HttpClientCodec(), new HttpObjectAggregator(65536), wsHandler, new WebSocketGremlinRequestEncoder(true, serializer), new WebSocketGremlinResponseDecoder(serializer), callbackResponseHandler); } });
@Override protected void initChannel(Channel channel) throws Exception { ChannelPipeline pipeline = channel.pipeline(); pipeline.addLast("codec", new HttpClientCodec()); } };