### Question:
ClientInputStream extends InputStream { @Override public void close() throws IOException { remote.close(); } 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 testClose() throws IOException { ServerInputStream si = new ServerInputStream(bi, exporter); ClientInputStream ci = new ClientInputStream((RemoteInputStream) si.getExported()); bi.reset(); assertEquals(buf[0], ci.read()); ci.close(); try { for (int i = 0; i < 10; i++) { try { Thread.sleep(Exporter.RETRY_DELAY * i); } catch (InterruptedException e) { } ci.read(); } fail("Failed to get expected exception"); } catch (NoSuchObjectException e) { } }