@Test public void testClose() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SnifferOutputStream sos = new SnifferOutputStream(snifferSocket, baos); sos.close(); verify(snifferSocket).logSocket(anyLong()); }
@Override public void close() throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { delegate.close(); } finally { snifferSocket.logSocket(System.currentTimeMillis() - start); } }
SnifferOutputStream extends OutputStream { @Override public void close() throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { delegate.close(); } finally { snifferSocket.logSocket(System.currentTimeMillis() - start); } } }
SnifferOutputStream extends OutputStream { @Override public void close() throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { delegate.close(); } finally { snifferSocket.logSocket(System.currentTimeMillis() - start); } } SnifferOutputStream(SnifferSocketImpl snifferSocket, OutputStream delegate); }
SnifferOutputStream extends OutputStream { @Override public void close() throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { delegate.close(); } finally { snifferSocket.logSocket(System.currentTimeMillis() - start); } } SnifferOutputStream(SnifferSocketImpl snifferSocket, OutputStream delegate); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); @Override void flush(); @Override void close(); }
SnifferOutputStream extends OutputStream { @Override public void close() throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { delegate.close(); } finally { snifferSocket.logSocket(System.currentTimeMillis() - start); } } SnifferOutputStream(SnifferSocketImpl snifferSocket, OutputStream delegate); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); @Override void flush(); @Override void close();  }