@Test
public void testAddBuffer() {

    DynamicCompositeByteBuf compositeByteBuf = new DynamicCompositeByteBuf();
    Assert.assertTrue(compositeByteBuf.readableBytes() == 0);
    ByteBuf byteBuf1 = Unpooled.wrappedBuffer("hello".getBytes());
    Assert.assertTrue(byteBuf1.refCnt() == 1);
    compositeByteBuf.addBuffer(byteBuf1);
    Assert.assertTrue(compositeByteBuf.readableBytes() == byteBuf1.readableBytes());
    Assert.assertTrue(byteBuf1.refCnt() == 1);
    ByteBuf byteBuf2 = Unpooled.wrappedBuffer("world".getBytes());
    compositeByteBuf.addBuffer(byteBuf2);
    Assert.assertTrue(compositeByteBuf.readableBytes() == byteBuf1.readableBytes() + byteBuf2.readableBytes());
    compositeByteBuf.release();
    Assert.assertTrue(byteBuf1.refCnt() == 0);
}