AsynchronousBufferFileWriter extends AsynchronousFileIOChannel<Buffer, WriteRequest> implements BufferFileWriter { @Override public int getNumberOfOutstandingRequests() { return requestsNotReturned.get(); } protected  AsynchronousBufferFileWriter(ID channelID, RequestQueue<WriteRequest> requestQueue); @Override void writeBlock(Buffer buffer); @Override int getNumberOfOutstandingRequests(); @Override boolean registerAllRequestsProcessedListener(NotificationListener listener);  }
@Test public void testAddAndHandleRequest() throws Exception { addRequest(); assertEquals("Didn't increment number of outstanding requests.", 1, writer.getNumberOfOutstandingRequests()); handleRequest(); assertEquals("Didn't decrement number of outstanding requests.", 0, writer.getNumberOfOutstandingRequests()); }