@Test
public void testReadRetainedSlice() {

    DynamicCompositeByteBuf compositeByteBuf = new DynamicCompositeByteBuf();
    ByteBuf buf = Unpooled.buffer(8);
    buf.writeInt(1);
    buf.writeInt(2);
    compositeByteBuf.addBuffer(buf);
    ByteBuf compositeByteBuf2 = compositeByteBuf.readRetainedSlice(4);
    Assert.assertTrue(compositeByteBuf.readableBytes() == 4);
    Assert.assertTrue(compositeByteBuf.readInt() == 2);
    Assert.assertTrue(compositeByteBuf2.readableBytes() == 4);
    Assert.assertTrue(compositeByteBuf2.readInt() == 1);
    compositeByteBuf2.release();
    Assert.assertTrue(buf.refCnt() == 0);
}