public void AddEmptyBufferInMiddle()
        {
            CompositeByteBuffer cbuf = Unpooled.CompositeBuffer();
            IByteBuffer         buf1 = Unpooled.Buffer().WriteByte(1);

            cbuf.AddComponent(true, buf1);
            cbuf.AddComponent(true, Unpooled.Empty);
            IByteBuffer buf3 = Unpooled.Buffer().WriteByte(2);

            cbuf.AddComponent(true, buf3);

            Assert.Equal(2, cbuf.ReadableBytes);
            Assert.Equal((byte)1, cbuf.ReadByte());
            Assert.Equal((byte)2, cbuf.ReadByte());

            Assert.Same(Unpooled.Empty, cbuf.InternalComponent(1));
            Assert.NotSame(Unpooled.Empty, cbuf.InternalComponentAtOffset(1));
            cbuf.Release();
        }
        public void DiscardSomeReadBytes()
        {
            CompositeByteBuffer cbuf = Unpooled.CompositeBuffer();
            int len = 8 * 4;

            for (int i = 0; i < len; i += 4)
            {
                IByteBuffer buf = Unpooled.Buffer().WriteInt(i);
                cbuf.AdjustCapacity(cbuf.WriterIndex);
                cbuf.AddComponent(buf).SetWriterIndex(i + 4);
            }
            cbuf.WriteByte(1);

            var me = new byte[len];

            cbuf.ReadBytes(me);
            cbuf.ReadByte();

            cbuf.DiscardSomeReadBytes();
            cbuf.Release();
        }