@Test public void testSkip() throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(DATA); SnifferInputStream sis = new SnifferInputStream(snifferSocket, bais); assertEquals(1, sis.skip(1)); byte[] buff = new byte[4]; assertEquals(3, sis.read(buff)); assertArrayEquals(new byte[]{2,3,4,0}, buff); assertEquals(0, sis.available()); verify(snifferSocket, times(2)).logSocket(anyLong()); verify(snifferSocket).logSocket(anyLong(), eq(3), eq(0)); }
@Override public long skip(long n) throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { return delegate.skip(n); } finally { snifferSocket.logSocket(System.currentTimeMillis() - start); } }
SnifferInputStream extends InputStream { @Override public long skip(long n) throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { return delegate.skip(n); } finally { snifferSocket.logSocket(System.currentTimeMillis() - start); } } }
SnifferInputStream extends InputStream { @Override public long skip(long n) throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { return delegate.skip(n); } finally { snifferSocket.logSocket(System.currentTimeMillis() - start); } } SnifferInputStream(SnifferSocketImpl snifferSocket, InputStream delegate); }
SnifferInputStream extends InputStream { @Override public long skip(long n) throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { return delegate.skip(n); } finally { snifferSocket.logSocket(System.currentTimeMillis() - start); } } SnifferInputStream(SnifferSocketImpl snifferSocket, InputStream delegate); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(long n); @Override int available(); @Override void close(); @Override void mark(int readlimit); @Override void reset(); @Override boolean markSupported(); }
SnifferInputStream extends InputStream { @Override public long skip(long n) throws IOException { snifferSocket.checkConnectionAllowed(0); long start = System.currentTimeMillis(); try { return delegate.skip(n); } finally { snifferSocket.logSocket(System.currentTimeMillis() - start); } } SnifferInputStream(SnifferSocketImpl snifferSocket, InputStream delegate); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(long n); @Override int available(); @Override void close(); @Override void mark(int readlimit); @Override void reset(); @Override boolean markSupported();  }