예제 #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);
 }