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

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

Introduction

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

Prototype

StompSubframeEncoder

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 w w  w. j  av a  2 s . c om*/
        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();
    }
}