@SuppressWarnings({ "rawtypes", "unchecked" })

@Test
public void receive_a_messagre_and_find_the_future_to_complete() {
    IoSession session = mock(IoSession.class);
    Response r = mock(Response.class);
    when(r.requestId()).thenReturn("ID");
    Map m = mock(Map.class);
    when(session.getAttribute(RequestFilter.IN_FLIGHT_REQUESTS)).thenReturn(m);
    RequestFuture f = mock(RequestFuture.class);
    when(m.remove("ID")).thenReturn(f);
    ReadFilterChainController ctl = mock(ReadFilterChainController.class);
    // run
    rq.messageReceived(session, r, ctl);
    // verify
    verify(session).getAttribute(RequestFilter.IN_FLIGHT_REQUESTS);
    verify(m).remove("ID");
    verify(r).requestId();
    verify(f).complete(r);
    verify(ctl).callReadNextFilter(r);
    verifyNoMoreInteractions(r, m, session, f, ctl);
}