HttpTunnelingClientSocketChannel( ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, ClientSocketChannelFactory clientSocketChannelFactory) { super(null, factory, pipeline, sink); config = new HttpTunnelingSocketChannelConfig(this); DefaultChannelPipeline channelPipeline = new DefaultChannelPipeline(); channelPipeline.addLast("decoder", new HttpResponseDecoder()); channelPipeline.addLast("encoder", new HttpRequestEncoder()); channelPipeline.addLast("handler", handler); realChannel = clientSocketChannelFactory.newChannel(channelPipeline); fireChannelOpen(this); }
@Override protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (msg instanceof HttpRequest && !done) { queue.offer(((HttpRequest) msg).getMethod()); } Object obj = super.encode(ctx, channel, msg); if (failOnMissingResponse) { // check if the request is chunked if so do not increment if (msg instanceof HttpRequest && !((HttpRequest) msg).isChunked()) { requestResponseCounter.incrementAndGet(); } else if (msg instanceof HttpChunk && ((HttpChunk) msg).isLast()) { // increment as its the last chunk requestResponseCounter.incrementAndGet(); } } return obj; } }
public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { encoder.handleDownstream(ctx, e); }
public ChannelPipeline getPipeline() throws Exception { List<ChannelHandler> handlers = new ArrayList<ChannelHandler>(); if (sslEnabled && !useServlet) { SSLEngine engine = context.createSSLEngine(); engine.setUseClientMode(true); engine.setWantClientAuth(true); SslHandler handler = new SslHandler(engine); handlers.add(handler); } if (httpEnabled) { handlers.add(new HttpRequestEncoder()); handlers.add(new HttpResponseDecoder()); handlers.add(new HttpChunkAggregator(Integer.MAX_VALUE)); handlers.add(new HttpHandler()); } handlers.add(new HornetQFrameDecoder2()); handlers.add(new HornetQClientChannelHandler(channelGroup, handler, new Listener())); ChannelPipeline pipeline = new StaticChannelPipeline(handlers.toArray(new ChannelHandler[handlers.size()])); return pipeline; } });
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("decoder", new HttpResponseDecoder()); pipeline.addLast("encoder", new HttpRequestEncoder()); pipeline.addLast("ws-handler", clientHandler); return pipeline; } });
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("decoder", new HttpResponseDecoder()); pipeline.addLast("encoder", new HttpRequestEncoder()); pipeline.addLast("ws-handler", clientHandler); return pipeline; } });
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("decoder", new HttpResponseDecoder()); pipeline.addLast("encoder", new HttpRequestEncoder()); pipeline.addLast("ws-handler", clientHandler); return pipeline; } });
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("decoder", new HttpResponseDecoder()); pipeline.addLast("encoder", new HttpRequestEncoder()); pipeline.addLast("ws-handler", clientHandler); return pipeline; } });
public ChannelPipeline getPipeline() { ChannelPipeline pipeline = pipeline(); pipeline.addLast("decoder", new HttpResponseDecoder()); pipeline.addLast("encoder", new HttpRequestEncoder()); pipeline.addLast("handler", new BucketUpdateResponseHandler()); return pipeline; } }
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("line", new DelimiterBasedFrameDecoder(Integer.MAX_VALUE, Delimiters.lineDelimiter())); pipeline.addLast("string", new StringDecoder()); pipeline.addLast("encoder", new HttpRequestEncoder()); pipeline.addLast("es-handler", clientHandler); return pipeline; } });
public ChannelPipeline getPipeline() throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = pipeline(); if (sslHandler != null) { pipeline.addLast("ssl", sslHandler); } pipeline.addLast("decoder", new HttpResponseDecoder()); // Uncomment the following line if you don't want to handle HttpChunks. pipeline.addLast("aggregator", new HttpChunkAggregator(MAX_CONTENT_SIZE)); pipeline.addLast("encoder", new HttpRequestEncoder()); return pipeline; }
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); if (tcpHelper.isSSL()) { SSLEngine engine = tcpHelper.getSSLContext().createSSLEngine(host, port); if (tcpHelper.isVerifyHost()) { SSLParameters sslParameters = engine.getSSLParameters(); sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); engine.setSSLParameters(sslParameters); } engine.setUseClientMode(true); //We are on the client side of the connection pipeline.addLast("ssl", new SslHandler(engine)); } pipeline.addLast("encoder", new HttpRequestEncoder()); pipeline.addLast("decoder", new SwitchingHttpResponseDecoder()); pipeline.addLast("handler", new ClientHandler()); return pipeline; } });
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = pipeline(); pipeline.addLast("requestEncoder", new HttpRequestEncoder()); pipeline.addLast("channelEncoder", new HttpEncoder(host, uri)); pipeline.addLast("responseDecoder", new HttpResponseDecoder()); pipeline.addLast("aggregator", new HttpChunkAggregator(1048576)); pipeline.addLast("thriftHandler", (ChannelHandler)handler); return pipeline; } }
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = pipeline(); pipeline.addLast("idle-detection", IDLE_STATE_HANDLER); pipeline.addLast("logging", new LoggingHandler(InternalLogLevel.DEBUG)); pipeline.addLast("http-deflater", new HttpContentCompressor()); pipeline.addLast("decoder", new HttpResponseDecoder(RESPONSE_MAX_INITIAL_LINE_LENGTH, RESPONSE_MAX_HEADER_SIZE, RESPONSE_MAX_CHUNK_SIZE)); pipeline.addLast("encoder", new HttpRequestEncoder()); pipeline.addLast("http-inflater", new HttpContentDecompressor()); pipeline.addLast("remote-hop-timer", new ClientTimingHandler("outbound")); pipeline.addLast("exception-surfacer", EXCEPTION_SURFACER); pipeline.addLast("idle-watchdog", new IdleChannelWatchdog("outbound")); return pipeline; }
pipeline.addLast( "http-encoder", new HttpRequestEncoder() ); pipeline.addLast( "http-decoder", new WebSocketHttpResponseDecoder( this.handshake ) ); pipeline.addLast( "websocket-connection-negotiator", new WebSocketConnectionNegotiator( this.clientContext.getServerAddress(), this.handshake, this.clientContext.isSecure() ) );