Example usage for io.netty.handler.codec.stomp StompSubframeDecoder StompSubframeDecoder

List of usage examples for io.netty.handler.codec.stomp StompSubframeDecoder StompSubframeDecoder

Introduction

In this page you can find the example usage for io.netty.handler.codec.stomp StompSubframeDecoder StompSubframeDecoder.

Prototype

public StompSubframeDecoder() 

Source Link

Usage

From source file:com.cmz.stomp.StompClient.java

License:Apache License

public static void main(String[] args) throws Exception {
    EventLoopGroup group = new NioEventLoopGroup();
    try {/*from   ww  w  . j a va  2  s  .  co  m*/
        Bootstrap b = new Bootstrap();
        b.group(group).channel(NioSocketChannel.class);
        b.handler(new ChannelInitializer<SocketChannel>() {
            @Override
            protected void initChannel(SocketChannel ch) throws Exception {
                ChannelPipeline pipeline = ch.pipeline();
                pipeline.addLast("decoder", new StompSubframeDecoder());
                pipeline.addLast("encoder", new StompSubframeEncoder());
                pipeline.addLast("aggregator", new StompSubframeAggregator(1048576));
                pipeline.addLast("handler", new StompClientHandler());
            }
        });

        b.connect(HOST, PORT).sync().channel().closeFuture().sync();
    } finally {
        group.shutdownGracefully();
    }
}