@Test public void testWriteByteArrayWithOffset() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SnifferOutputStream sos = new SnifferOutputStream(snifferSocket, baos); sos.write(DATA, 1, 2); verify(snifferSocket).logSocket(anyLong(), eq(0), eq(2)); }
@Override public void write(int b) throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { delegate.write(b); } finally { sleepIfRequired(1); snifferSocket.logSocket(System.currentTimeMillis() - start, 0, 1); } }
SnifferOutputStream extends OutputStream { @Override public void write(int b) throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { delegate.write(b); } finally { sleepIfRequired(1); snifferSocket.logSocket(System.currentTimeMillis() - start, 0, 1); } } }
SnifferOutputStream extends OutputStream { @Override public void write(int b) throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { delegate.write(b); } finally { sleepIfRequired(1); snifferSocket.logSocket(System.currentTimeMillis() - start, 0, 1); } } SnifferOutputStream(SnifferSocketImpl snifferSocket, OutputStream delegate); }
SnifferOutputStream extends OutputStream { @Override public void write(int b) throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { delegate.write(b); } finally { sleepIfRequired(1); snifferSocket.logSocket(System.currentTimeMillis() - start, 0, 1); } } 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 write(int b) throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { delegate.write(b); } finally { sleepIfRequired(1); snifferSocket.logSocket(System.currentTimeMillis() - start, 0, 1); } } 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();  }