  @Test public void testRandomReads() throws Exception {

    Random random = new Random();
    int length = random.nextInt(SIZE);
    byte[] data = new byte[length];
    random.nextBytes(data);

    Input in = new InputBytes(data);
      
    for (int i = 0; i < COUNT; i++) {
      int p = random.nextInt(length);
      int l = Math.min(random.nextInt(SIZE/10), length-p);
      byte[] buffer = new byte[l];
      in.read(p, buffer, 0, l);
      Assert.assertArrayEquals(Arrays.copyOfRange(data, p, p+l), buffer);
    }
  }