    @Test
    public void decode() throws Exception {


        ByteBuf buf = Unpooled.buffer();

        for (int i = 0; i < 9; i++) {
            buf.writeByte(i);
        }

        ByteBuf duplicate = buf.duplicate();

        EmbeddedChannel channel = new EmbeddedChannel(new FixLengthDecoder(3));
        channel.writeInbound(buf.retain());
        channel.finish();

        ByteBuf read = channel.readInbound();
        Assert.assertEquals(duplicate.readSlice(3), read);


        read = channel.readInbound();
        Assert.assertEquals(duplicate.readSlice(3), read);

        read = channel.readInbound();
        Assert.assertEquals(duplicate.readSlice(3), read);

        read.release();


    }