### Question:
ClosedOutputStream extends OutputStream { @Override public void write(final int b) throws IOException { throw new IOException("write(" + b + ") failed: stream is closed"); }  @Override void write(final int b); static final ClosedOutputStream CLOSED_OUTPUT_STREAM; }### Answer:
@Test public void testRead() throws Exception { ClosedOutputStream cos = null; try { cos = new ClosedOutputStream(); cos.write('x'); fail("write(b)"); } catch (final IOException e) { } finally { cos.close(); } }