### Question:
ClientInputStream extends InputStream { @Override public int read() throws IOException { return remote.read(); } ClientInputStream(RemoteInputStream remote); @Override int read(); @Override int read(byte[] buf, int off, int len); @Override long skip(long n); @Override void close();  }### Answer:
@Test public void testRead() throws IOException { bi.reset(); for (byte b : buf) assertEquals(b, ci.read()); assertEquals(-1, ci.read()); }
@Test public void testReadByteArray() throws IOException { bi.reset(); byte[] r = new byte[100]; assertEquals(buf.length, ci.read(r)); for (int i = 0; i < buf.length; i++) assertEquals(buf[i], r[i]); assertEquals(-1, ci.read()); bi.reset(); r = new byte[0]; assertEquals(0, ci.read(r)); }
@Test public void testReadByteArrayIntInt() throws IOException { bi.reset(); byte[] r = new byte[100]; bogusIndex(r, -1, 10); bogusIndex(r, 10, -1); bogusIndex(r, -1, -1); bogusIndex(r, 50, 51); bogusIndex(r, 101, 1); bogusIndex(r, 0, 101); int off = r.length - buf.length; assertEquals(buf.length, ci.read(r, off, buf.length)); for (int i = 0; i < buf.length; i++) assertEquals(buf[i], r[off + i]); assertEquals(-1, ci.read()); }