### Question:
ServerInputStream extends UnicastExportable implements RemoteInputStream, Closeable { @Override public void unreferenced() { try { close(); } catch (IOException e) { log.warn("Ignoring error in close of this unreferenced InputStream", e); } } ServerInputStream(InputStream in, Exporter exporter); int read(); PartialBuffer read(int len); long skip(long n); void close(); @Override void unreferenced();  }### Answer:
@Test public void testUnreferenced() throws IOException { final boolean[] closed = new boolean[] { false, false }; ByteArrayInputStream bi = new ByteArrayInputStream(buf) { @Override public void close() throws IOException { closed[0] = true; super.close(); } }; ServerInputStream si = new ServerInputStream(bi, exporter) { private static final long serialVersionUID = 1L; @Override public void unExport(boolean force) { closed[1] = true; super.unExport(force); } }; si.read(100); assertFalse(closed[0]); assertFalse(closed[1]); si.unreferenced(); assertTrue(closed[0]); assertTrue(closed[1]); }