UnsyncFilterInputStream extends InputStream { @Override public long skip(long skip) throws IOException { return inputStream.skip(skip); } UnsyncFilterInputStream(InputStream inputStream); @Override int available(); @Override void close(); @Override void mark(int readLimit); @Override boolean markSupported(); @Override int read(); @Override int read(byte[] bytes); @Override int read(byte[] bytes, int offset, int length); @Override void reset(); @Override long skip(long skip);  }
@Test public void testSkip() throws IOException { long expectedSkip = 1; AtomicBoolean skipCalled = new AtomicBoolean(); UnsyncFilterInputStream unsyncFilterInputStream = new UnsyncFilterInputStream( new TestInputStream() { @Override public long skip(long skip) { Assert.assertEquals(expectedSkip, skip); skipCalled.set(true); return 0; } }); Assert.assertEquals(0, unsyncFilterInputStream.skip(expectedSkip)); Assert.assertTrue(skipCalled.get()); }