Multiple ChannelInboundHandlerAdapter's in Netty pipleline
<p>I'm quite new with netty, I want to create a TCP server which does a custom application layer handshaking when a connection is to be instantiated. After the handshaking I want to pass the messages (ByteBuf) to a queue so that they could be processed by some other threads.</p>

<p>My question is, can I have multiple ChannelInboundHandlerAdapter's in the channel pipeline? one for  the application layer handshaking protocol and the other one for passing the message to the queue. Furthermore I want to know how the messages flow through the pipeline. If a message is received at one handler (or decoder/encoder) how is it passed to another handler.</p>

<p>Specifically, if I change the EchoServer from <a href="https://raw.githubusercontent.com/normanmaurer/netty-in-action/master/src/main/java/com/manning/nettyinaction/chapter2/EchoServerHandler.java" rel="nofollow">here</a> and add another ChannelInboundHandlerAdapter, the echo server handler would stop receiving any messages.</p>

<pre><code>ServerBootstrap b = new ServerBootstrap();
            b.group(group)
             .channel(NioServerSocketChannel.class)
             .localAddress(new InetSocketAddress(port))
             .childHandler(new ChannelInitializer&lt;SocketChannel&gt;() {
                 @Override
                 public void initChannel(SocketChannel ch) 
                     throws Exception {
                 ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                     @Override
                     public void channelRead(ChannelHandlerContext ctx,
                          Object msg) {
                           }
                          });

                  ch.pipeline().addLast(
                       new EchoServerHandler());
                 }
                 });
</code></pre>

<p>My logic is: have 2 ChannelInboundHandlerAdapter's then do the handshaking with the first handler and discard packets if they do not match the handshaking criteria, and then pass the messages to a queue through the second ChannelInboundHandlerAdapter. Is my logic correct? If not how should it be?</p>

<p>Thank you very much.</p>