### Question:
ProxyOutputStream extends FilterOutputStream { @Override public void write(final int idx) throws IOException { try { beforeWrite(1); out.write(idx); afterWrite(1); } catch (final IOException e) { handleIOException(e); } } ProxyOutputStream(final OutputStream proxy); @Override void write(final int idx); @Override void write(final byte[] bts); @Override void write(final byte[] bts, final int st, final int end); @Override void flush(); @Override void close();  }### Answer:
@Test public void testWrite() throws Exception { proxied.write('y'); assertEquals(1, original.size()); assertEquals('y', original.toByteArray()[0]); }
@Test public void testWriteNullBaSucceeds() throws Exception { final byte[] ba = null; original.write(ba); proxied.write(ba); }