UnsyncFilterInputStream extends InputStream { @Override public void mark(int readLimit) { inputStream.mark(readLimit); } 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 testMark() { int expectedReadLimit = 1; AtomicBoolean markCalled = new AtomicBoolean(); UnsyncFilterInputStream unsyncFilterInputStream = new UnsyncFilterInputStream( new TestInputStream() { @Override public void mark(int readLimit) { Assert.assertEquals(expectedReadLimit, readLimit); markCalled.set(true); } }); unsyncFilterInputStream.mark(expectedReadLimit); Assert.assertTrue(markCalled.get()); }