@Override
  public int read() throws IOException {
    throwIfClosed();

    if (remoteObject.size() == 0
        || nextReadPos >= remoteObject.size()) {
      return -1;
    }

    if (!ensureCurrentBuffer()) {
      return -1;
    }

    nextReadPos++;
    incrementBytesRead(1);

    return fpos.buffer().get() & 0xff;
  }
@Test
  public void testRead() throws Exception {
    S3ARemoteInputStream inputStream =
        S3APrefetchFakes.createS3InMemoryInputStream(futurePool, "bucket",
            "key", FILE_SIZE);
    testReadHelper(inputStream, FILE_SIZE);

    inputStream =
        S3APrefetchFakes.createS3CachingInputStream(futurePool, "bucket", "key",
            FILE_SIZE, 5, 2);
    testReadHelper(inputStream, 5);
  }