For a socket server app, i created a PacketFragmenter that reads packet's length (in the second byte of the packet) and then send the packet back to the pipeline.

here is the code i Wrote : 

```
public class PacketFragmenter extends ByteToMessageDecoder {

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in,
            List<Object> out) throws Exception {
        //I read a byte just to make the reader index go to second byte
        in.readByte();

        //in the second byte i get the content's length
        int length = in.readByte();

        //if my content is smaller than the readableBytes, there's a problem, so i return
        if (in.readableBytes() < length) {
            return;
        }

        //If everything is good, i reset the reader index to be able to write the whole packet in the out buffer (because i need the first byte in next handler, same for the size)
        in.resetReaderIndex();
        //I send my packet to the next handler
        out.add(in.readBytes(length +2));
        //and i reset the rederIndex to be able to read another packet
        in.resetReaderIndex();
    }

}

```

i got this stack on tests :

```
io.netty.handler.codec.DecoderException: PacketFragmenter.decode() did not read anything but decoded a message.
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:334)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:229)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:847)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
    at java.lang.Thread.run(Thread.java:745)

```

but everything's playing like it should, i get two packets in a row but they are nicely spliced, and the next handler is doing his job.

So i don't know if I should handle this exception or ignore it? Or maybe i can do a simple thing to fix it, I'm not a netty expert at all (started a week ago), so that should be easy to fix. But i found nothing on netty's user guide.