Package io.netty.handler.codec

Examples of io.netty.handler.codec.LineBasedFrameDecoder


  @Override
    public void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();

        pipeline.addLast("framer", new LineBasedFrameDecoder(1024));
        pipeline.addLast("decoder", DECODER);

        pipeline.addLast("handler", serverHandler);
    }
View Full Code Here


             .childHandler(new ChannelInitializer<SocketChannel>() {
                 @Override
                 public void initChannel(SocketChannel ch) throws Exception {
                     ch.pipeline().addLast(
                             new StringEncoder(BufType.BYTE, CharsetUtil.UTF_8),
                             new LineBasedFrameDecoder(8192),
                             new StringDecoder(CharsetUtil.UTF_8),
                             new FileHandler());
                 }
             });
View Full Code Here

             .channel(RxtxChannel.class)
             .handler(new ChannelInitializer<RxtxChannel>() {
                 @Override
                 public void initChannel(RxtxChannel ch) throws Exception {
                     ch.pipeline().addLast(
                         new LineBasedFrameDecoder(32768),
                         new StringEncoder(BufType.BYTE),
                         new StringDecoder(),
                         new RxtxClientHandler()
                     );
                 }
View Full Code Here

          engine.setUseClientMode(true);
          pipeline.addLast("ssl", new SslHandler(engine));
        }

        // Decoders
        pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1000));
        pipeline.addLast("stringDecoder", new StringDecoder(CharsetUtil.UTF_8));

        // Encoder
        pipeline.addLast("stringEncoder", new StringEncoder(CharsetUtil.UTF_8));
View Full Code Here

        .env(env)
        .options(new NettyServerSocketOptions()
                     .pipelineConfigurer(new Consumer<ChannelPipeline>() {
                       @Override
                       public void accept(ChannelPipeline pipeline) {
                         pipeline.addLast(new LineBasedFrameDecoder(8 * 1024));
                       }
                     }))
        .listen(port)
        .codec(StandardCodecs.STRING_CODEC)
        .consume(serverHandler)
View Full Code Here

            public void initChannel(SocketChannel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();
                if (sslContext != null) {
                    p.addLast(sslContext.newHandler(ch.alloc()));
                }
                p.addLast(new LineBasedFrameDecoder(8192));
                p.addLast(new StringDecoder(CharsetUtil.UTF_8));
                p.addLast(new SnappyFramedEncoder());
                p.addLast(new RecordIdEncoder());
                p.addLast(new SegmentEncoder());
                p.addLast(handler);
View Full Code Here

public class LineBasedHandlerInitializer extends ChannelInitializer<Channel> {

    @Override
    protected void initChannel(Channel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new LineBasedFrameDecoder(65 * 1024));
        pipeline.addLast(new FrameHandler());
    }
View Full Code Here

            }

            Socks5CmdRequest req = (Socks5CmdRequest) msg;
            assertThat(req.cmdType(), is(Socks5CmdType.CONNECT));

            ctx.pipeline().addBefore(ctx.name(), "lineDecoder", new LineBasedFrameDecoder(64, false, true));

            Socks5CmdResponse res;
            boolean sendGreeting = false;
            if (!req.host().equals(destination.getHostString()) ||
                       req.port() != destination.getPort()) {
View Full Code Here

            b.handler(new ChannelInitializer<SocketChannel>() {
                @Override
                protected void initChannel(SocketChannel ch) throws Exception {
                    ChannelPipeline p = ch.pipeline();
                    p.addLast(clientHandlers);
                    p.addLast(new LineBasedFrameDecoder(64));
                    p.addLast(testHandler);
                }
            });

            boolean finished = b.connect(destination).channel().closeFuture().await(10, TimeUnit.SECONDS);
View Full Code Here

            b.handler(new ChannelInitializer<SocketChannel>() {
                @Override
                protected void initChannel(SocketChannel ch) throws Exception {
                    ChannelPipeline p = ch.pipeline();
                    p.addLast(clientHandlers);
                    p.addLast(new LineBasedFrameDecoder(64));
                    p.addLast(testHandler);
                }
            });

            boolean finished = b.connect(destination).channel().closeFuture().await(10, TimeUnit.SECONDS);
View Full Code Here

TOP

Related Classes of io.netty.handler.codec.LineBasedFrameDecoder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.