public void FullConsolidation()
        {
            CompositeByteBuffer buf = Unpooled.CompositeBuffer(int.MaxValue);

            buf.AddComponent(Unpooled.WrappedBuffer(new byte[] { 1 }));
            buf.AddComponent(Unpooled.WrappedBuffer(new byte[] { 2, 3 }));
            buf.AddComponent(Unpooled.WrappedBuffer(new byte[] { 4, 5, 6 }));
            buf.Consolidate();

            Assert.Equal(1, buf.NumComponents);
            Assert.True(buf.HasArray);
            Assert.NotNull(buf.Array);
            Assert.Equal(0, buf.ArrayOffset);

            buf.Release();
        }
        public void RangedConsolidation()
        {
            CompositeByteBuffer buf = Unpooled.CompositeBuffer(int.MaxValue);

            buf.AddComponent(Unpooled.WrappedBuffer(new byte[] { 1 }));
            buf.AddComponent(Unpooled.WrappedBuffer(new byte[] { 2, 3 }));
            buf.AddComponent(Unpooled.WrappedBuffer(new byte[] { 4, 5, 6 }));
            buf.AddComponent(Unpooled.WrappedBuffer(new byte[] { 7, 8, 9, 10 }));
            buf.Consolidate(1, 2);

            Assert.Equal(3, buf.NumComponents);
            Assert.Equal(Unpooled.WrappedBuffer(new byte[] { 1 }), buf[0]);
            Assert.Equal(Unpooled.WrappedBuffer(new byte[] { 2, 3, 4, 5, 6 }), buf[1]);
            Assert.Equal(Unpooled.WrappedBuffer(new byte[] { 7, 8, 9, 10 }), buf[2]);

            buf.Release();
        }