### Question:
AutoCloseInputStream extends ProxyInputStream { @Override public void close() throws IOException { in.close(); in = new ClosedInputStream(); } AutoCloseInputStream(final InputStream in); @Override void close();  }### Answer:
@Test public void testClose() throws IOException { stream.close(); assertTrue("closed", closed); assertEquals("read()", -1, stream.read()); }