List of usage examples for io.netty.channel ChannelPipeline addLast
ChannelPipeline addLast(EventExecutorGroup group, ChannelHandler... handlers);
From source file:com.corundumstudio.socketio.SocketIOChannelInitializer.java
License:Apache License
/** * Adds the ssl handler/* w w w.ja va2 s . com*/ * * @return */ protected void addSslHandler(ChannelPipeline pipeline) { if (sslContext != null) { SSLEngine engine = sslContext.createSSLEngine(); engine.setUseClientMode(false); pipeline.addLast(SSL_HANDLER, new SslHandler(engine)); } }
From source file:com.corundumstudio.socketio.SocketIOChannelInitializer.java
License:Apache License
/** * Adds the socketio channel handlers/*from w ww . j ava 2 s . c om*/ * * @param pipeline */ protected void addSocketioHandlers(ChannelPipeline pipeline) { pipeline.addLast(HTTP_REQUEST_DECODER, new HttpRequestDecoder()); pipeline.addLast(HTTP_AGGREGATOR, new HttpObjectAggregator(configuration.getMaxHttpContentLength())); pipeline.addLast(HTTP_ENCODER, new HttpResponseEncoder()); pipeline.addLast(PACKET_HANDLER, packetHandler); pipeline.addLast(AUTHORIZE_HANDLER, authorizeHandler); pipeline.addLast(XHR_POLLING_TRANSPORT, xhrPollingTransport); pipeline.addLast(WEB_SOCKET_TRANSPORT, webSocketTransport); pipeline.addLast(SOCKETIO_ENCODER, encoderHandler); pipeline.addLast(WRONG_URL_HANDLER, wrongUrlHandler); }
From source file:com.cssweb.network.NettyClientInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) { ChannelPipeline pipeline = ch.pipeline(); // Enable stream compression (you can remove these two if unnecessary) //pipeline.addLast(ZlibCodecFactory.newZlibEncoder(ZlibWrapper.GZIP)); //pipeline.addLast(ZlibCodecFactory.newZlibDecoder(ZlibWrapper.GZIP)); // Add the number codec first, pipeline.addLast("decoder", new CustomDecoder()); pipeline.addLast("encoder", new CustomEncoder()); // and then business logic. pipeline.addLast(new NettyClientHandler()); }
From source file:com.cssweb.network.NettyServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); // Enable stream compression (you can remove these two if unnecessary) //pipeline.addLast("deflater", ZlibCodecFactory.newZlibEncoder(ZlibWrapper.GZIP)); //pipeline.addLast("inflater", ZlibCodecFactory.newZlibDecoder(ZlibWrapper.GZIP)); // Add the number codec first, pipeline.addLast("decoder", new CustomDecoder()); pipeline.addLast("encoder", new CustomEncoder()); // and then business logic. // Please note we create a handler for every new channel // because it has stateful properties. pipeline.addLast("handler", new NettyServerHandler(queue)); }
From source file:com.cssweb.payment.posp.server.NettyServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); // Enable stream compression (you can remove these two if unnecessary) //pipeline.addLast("deflater", ZlibCodecFactory.newZlibEncoder(ZlibWrapper.GZIP)); //pipeline.addLast("inflater", ZlibCodecFactory.newZlibDecoder(ZlibWrapper.GZIP)); // Add the number codec first, pipeline.addLast("decoder", new CustomDecoder()); pipeline.addLast("encoder", new CustomEncoder()); // and then business logic. // Please note we create a handler for every new channel // because it has stateful properties. pipeline.addLast("handler", new NettyServerHandler(client)); }
From source file:com.curlymaple.sandbox.SandboxServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("decoder", decoder); pipeline.addLast("encoder", encoder); pipeline.addLast("handler", handler); }
From source file:com.curlymaple.server.ServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("logger", loggingHandler); pipeline.addLast("decoder", decoder); pipeline.addLast("encoder", encoder); pipeline.addLast("handler", handler); }
From source file:com.elephant.framework.network.telnet.netty.TelnetClientInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); // Add the text line codec combination first, pipeline.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter())); pipeline.addLast("decoder", DECODER); pipeline.addLast("encoder", ENCODER); // and then business logic. pipeline.addLast("handler", CLIENTHANDLER); }
From source file:com.elephant.framework.network.telnet.netty.TelnetServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); // Add the text line codec combination first, pipeline.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter())); // the encoder and decoder are static as these are sharable pipeline.addLast("decoder", DECODER); pipeline.addLast("encoder", ENCODER); // and then business logic. pipeline.addLast("handler", SERVERHANDLER); }
From source file:com.emin.igwmp.skm.core.netty.handler.SocksServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4)); pipeline.addLast("frameEncoder", new LengthFieldPrepender(4)); // AMF3 ??// w w w.j av a 2 s . c o m //pipeline.addLast("decoder", new DecoderAMF3()); //pipeline.addLast("encoder", new EncoderAMF3()); // ?object?? ?Java Object //pipeline.addLast("objectEncoder", new ObjectEncoder()); //pipeline.addLast("objectDecoder", new ObjectDecoder(ClassResolvers.cacheDisabled(null))); // UTF-8??? ? ? pipeline.addLast("decoder", new StringDecoder(CharsetUtil.UTF_8)); pipeline.addLast("encoder", new StringEncoder(CharsetUtil.UTF_8)); pipeline.addLast("ping", new IdleStateHandler(5, 5, 10)); // // 20s20s 30s pipeline.addLast("handler", socksServerHandler); // ch.pipeline().addLast( // new LoggingHandler(LogLevel.DEBUG), // new SocksPortUnificationServerHandler(), }