コード例 #1
0
 @Test
 public void shouldHaveSameByteOrder() {
   ByteBuf buf = Unpooled.buffer(1);
   assertSame(Unpooled.BIG_ENDIAN, Unpooled.unmodifiableBuffer(buf).order());
   buf = buf.order(LITTLE_ENDIAN);
   assertSame(Unpooled.LITTLE_ENDIAN, Unpooled.unmodifiableBuffer(buf).order());
 }
コード例 #2
0
 @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);
 }
コード例 #3
0
 @Test
 public void shouldReturnWritableCopy() {
   ByteBuf buf = Unpooled.unmodifiableBuffer(Unpooled.buffer(1));
   assertFalse(buf.copy() instanceof ReadOnlyByteBuf);
 }
コード例 #4
0
 @Test
 public void testUnwrap() {
   ByteBuf buf = Unpooled.buffer(1);
   assertSame(buf, ((WrappedByteBuf) Unpooled.unmodifiableBuffer(buf)).unwrap());
 }
コード例 #5
0
 @Test
 public void testUnmodifiableBuffer() {
   assertTrue(Unpooled.unmodifiableBuffer(Unpooled.buffer(1)) instanceof ReadOnlyByteBuf);
 }