@Test
public void testClear() {

   byte[] data = new byte[] {0, 1, 2, 3, 4};
   ByteBuf byteBuffer = Unpooled.wrappedBuffer(data);
   NettyReadable buffer = new NettyReadable(byteBuffer);
   byte[] target = new byte[data.length];
   buffer.get(target);
   assertFalse(buffer.hasRemaining());
   assertArrayEquals(data, target);
   try {
      buffer.get(target);
      fail("Should throw an IndexOutOfBoundsException");
   } catch (IndexOutOfBoundsException ioe) {
   }
   buffer.clear();
   assertTrue(buffer.hasRemaining());
   assertEquals(data.length, buffer.remaining());
   buffer.get(target);
   assertFalse(buffer.hasRemaining());
   assertArrayEquals(data, target);
}