List of usage examples for io.netty.channel ChannelPipeline addLast
ChannelPipeline addLast(EventExecutorGroup group, ChannelHandler... handlers);
From source file:com.hazelcast.simulator.protocol.connector.WorkerConnector.java
License:Open Source License
@Override void configureServerPipeline(ChannelPipeline pipeline, ServerConnector serverConnector) { pipeline.addLast("connectionValidationHandler", new ConnectionValidationHandler()); pipeline.addLast("connectionListenerHandler", new ConnectionListenerHandler(connectionManager)); pipeline.addLast("responseEncoder", new ResponseEncoder(localAddress)); pipeline.addLast("messageEncoder", new MessageEncoder(localAddress, localAddress.getParent())); pipeline.addLast("frameDecoder", new SimulatorFrameDecoder()); pipeline.addLast("protocolDecoder", new SimulatorProtocolDecoder(localAddress)); pipeline.addLast("messageConsumeHandler", new MessageConsumeHandler(localAddress, processor)); pipeline.addLast("testProtocolDecoder", new SimulatorProtocolDecoder(localAddress.getChild(0))); pipeline.addLast("testMessageConsumeHandler", new MessageTestConsumeHandler(testProcessorManager, localAddress)); pipeline.addLast("responseHandler", new ResponseHandler(localAddress, localAddress.getParent(), futureMap, addressIndex)); pipeline.addLast("exceptionHandler", new ExceptionHandler(serverConnector)); }
From source file:com.heliosapm.streams.forwarder.HttpJsonMetricForwarder.java
License:Apache License
/** * {@inheritDoc}/*from w ww .ja va 2 s .c o m*/ * @see io.netty.channel.ChannelInitializer#initChannel(io.netty.channel.Channel) */ @Override protected void initChannel(final SocketChannel ch) throws Exception { final ChannelPipeline p = ch.pipeline(); //p.addLast("compressor", new HttpContentCompressor()); p.addLast("httpCodec", new HttpClientCodec()); //p.addLast("logger", lh); p.addLast("outhandler", outboundHandler); p.addLast("inhandler", inboundHandler); // p.addLast("httpcodec", new HttpClientCodec()); // p.addLast("inflater", new HttpContentDecompressor()); // p.addLast("qdecoder", queryResultDecoder); }
From source file:com.heliosapm.streams.metrichub.HubManager.java
License:Apache License
/** * {@inheritDoc}// w w w. ja v a 2 s . c om * @see io.netty.channel.pool.ChannelPoolHandler#channelCreated(io.netty.channel.Channel) */ @Override public void channelCreated(final Channel ch) throws Exception { log.debug("Channel Created: {}", ch); channelGroup.add(ch); final ChannelPipeline p = ch.pipeline(); //p.addLast("timeout", new IdleStateHandler(0, 0, 60)); // TODO: configurable p.addLast("httpcodec", new HttpClientCodec()); p.addLast("inflater", new HttpContentDecompressor()); // p.addLast("deflater", new HttpContentCompressor()); p.addLast("aggregator", new HttpObjectAggregator(20485760)); // p.addLast("logging", loggingHandler); p.addLast("qdecoder", queryResultDecoder); }
From source file:com.heliosapm.streams.onramp.PipelineFactory.java
License:Apache License
/** * {@inheritDoc}/*from w w w. ja v a 2 s .c o m*/ * @see io.netty.channel.ChannelInitializer#initChannel(io.netty.channel.Channel) */ @Override protected void initChannel(final SocketChannel ch) throws Exception { final ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("idlestate", new IdleStateHandler(0, 0, 120)); // this.socketTimeout // pipeline.addLast("idlereaper", idleReaper); pipeline.addLast("connmgr", connmgr); pipeline.addLast("gzipdetector", new GZipDetector()); pipeline.addLast("detect", HTTP_OR_RPC); }
From source file:com.heliosapm.streams.onramp.UDPPipelineFactory.java
License:Apache License
/** * {@inheritDoc}// w ww . j av a 2 s. c om * @see io.netty.channel.ChannelInitializer#initChannel(io.netty.channel.Channel) */ @Override protected void initChannel(final AbstractChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast("bytesDecoder", bytesDecoder); p.addLast("framer", new LineBasedFrameDecoder(1024, true, true)); p.addLast("linehandler", new StringMetricHandler()); }
From source file:com.heliosapm.tsdblite.handlers.ProtocolSwitch.java
License:Apache License
private void enableGzip(ChannelHandlerContext ctx) { ChannelPipeline p = ctx.pipeline(); p.addLast("gzipdeflater", ZlibCodecFactory.newZlibEncoder(ZlibWrapper.GZIP)); p.addLast("gzipinflater", ZlibCodecFactory.newZlibDecoder(ZlibWrapper.GZIP)); p.addLast("2ndPhaseSwitch", new ProtocolSwitch(false)); p.remove(this); log.info("enabled gzip: [{}]", ctx.channel().id()); }
From source file:com.heliosapm.tsdblite.handlers.ProtocolSwitch.java
License:Apache License
private void switchToHttp(ChannelHandlerContext ctx) { ChannelPipeline p = ctx.pipeline(); //p.addLast("logging", loggingHandler); // p.addLast(new HttpObjectAggregator(1048576)); final HttpServerCodec sourceCodec = new HttpServerCodec(); p.addLast("httpCodec", sourceCodec); // HttpServerUpgradeHandler.UpgradeCodec upgradeCodec = new Http2ServerUpgradeCodec(new HelloWorldHttp2Handler()); // HttpServerUpgradeHandler upgradeHandler = new HttpServerUpgradeHandler(sourceCodec, Collections.singletonList(upgradeCodec), 65536); // p.addLast("http2Upgrader", upgradeHandler); // p.addLast("encoder", new HttpResponseEncoder()); // p.addLast("decoder", new HttpRequestDecoder()); // p.addLast("deflater", new HttpContentCompressor(1)); p.addLast("inflater", new HttpContentDecompressor()); //p.addLast("logging", loggingHandler); //p.addLast("encoder", new HttpResponseEncoder()); //p.addLast("logging", loggingHandler); // p.addLast("logging", loggingHandler); //WebSocketServerHandler //p.addLast(eventExecutorGroup, "requestManager", new WebSocketServerHandler()); p.addLast(new HttpObjectAggregator(1048576 * 2)); p.addLast("httpSwitch", HTTP_SWITCH); // p.addLast(eventExecutorGroup, "requestManager", HttpRequestManager.getInstance()); // p.addLast("requestManager", HttpRequestManager.getInstance()); p.remove(this); }
From source file:com.heliosapm.tsdblite.handlers.ProtocolSwitch.java
License:Apache License
private void switchToPlainText(ChannelHandlerContext ctx) { ChannelPipeline p = ctx.pipeline(); p.addLast("framer", new LineBasedFrameDecoder(1024)); p.addLast("encoder", PLAINTEXT_ENCODER); p.addLast("decoder", PLAINTEXT_DECODER); p.addLast("traceDecoder", TRACE_DECODER); p.remove(this); log.info("switched to plain text: [{}]", ctx.channel().id()); }
From source file:com.helome.messagecenter.master.HttpServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { // Create a default pipeline implementation. ChannelPipeline p = ch.pipeline(); // Uncomment the following line if you want HTTPS //SSLEngine engine = SecureChatSslContextFactory.getServerContext().createSSLEngine(); //engine.setUseClientMode(false); //p.addLast("ssl", new SslHandler(engine)); p.addLast("decoder", new HttpRequestDecoder()); // Uncomment the following line if you don't want to handle HttpChunks. //p.addLast("aggregator", new HttpObjectAggregator(1048576)); p.addLast("encoder", new HttpResponseEncoder()); // Remove the following line if you don't want automatic content compression. //p.addLast("deflater", new HttpContentCompressor()); p.addLast("handler", new HttpServerHandler()); }
From source file:com.hop.hhxx.example.http.upload.HttpUploadClientIntializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) { ChannelPipeline pipeline = ch.pipeline(); if (sslCtx != null) { pipeline.addLast("ssl", sslCtx.newHandler(ch.alloc())); }//from w w w . j a v a 2 s. c o m pipeline.addLast("codec", new HttpClientCodec()); // Remove the following line if you don't want automatic content decompression. pipeline.addLast("inflater", new HttpContentDecompressor()); // to be used since huge file transfer pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); pipeline.addLast("handler", new io.netty.example.http.upload.HttpUploadClientHandler()); }