@Test public void shouldReturnReadOnlyDerivedBuffer() { ByteBuf buf = Unpooled.unmodifiableBuffer(Unpooled.buffer(1)); assertTrue(buf.duplicate() instanceof ReadOnlyByteBuf); assertTrue(buf.slice() instanceof ReadOnlyByteBuf); assertTrue(buf.slice(0, 1) instanceof ReadOnlyByteBuf); assertTrue(buf.duplicate() instanceof ReadOnlyByteBuf); }
@Override public ByteBuf duplicate() { return buf.duplicate(); }