@Test
public void clearAllOutstandingRequests() {
TransportResponseHandler handler = new TransportResponseHandler(new LocalChannel());
ChunkReceivedCallback callback = mock(ChunkReceivedCallback.class);
handler.addFetchRequest(new StreamChunkId(1, 0), callback);
handler.addFetchRequest(new StreamChunkId(1, 1), callback);
handler.addFetchRequest(new StreamChunkId(1, 2), callback);
assertEquals(3, handler.numOutstandingRequests());
handler.handle(new ChunkFetchSuccess(new StreamChunkId(1, 0), new TestManagedBuffer(12)));
handler.exceptionCaught(new Exception("duh duh duhhhh"));
// should fail both b2 and b3
verify(callback, times(1)).onSuccess(eq(0), (ManagedBuffer) any());
verify(callback, times(1)).onFailure(eq(1), (Throwable) any());