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

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

Introduction

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

Prototype

public StompSubframeAggregator(int maxContentLength) 

Source Link

Document

Creates a new instance.

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  ww .  j a v  a 2s . com
        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();
    }
}