Mockito.any(HttpContext.class));
}
@Test
public void testRequestHandlingHttpException() throws Exception {
State state = new HttpAsyncService.State();
HttpContext exchangeContext = state.getContext();
BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/",
HttpVersion.HTTP_1_1);
state.setRequestState(MessageState.BODY_STREAM);
state.setRequest(request);
state.setRequestConsumer(this.requestConsumer);
state.setRequestHandler(this.requestHandler);
this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
Mockito.when(this.decoder.isCompleted()).thenReturn(true);
Mockito.when(this.requestConsumer.getException()).thenReturn(null);
Object data = new Object();
Mockito.when(this.requestConsumer.getResult()).thenReturn(data);
Mockito.doThrow(new UnsupportedHttpVersionException()).when(
this.requestHandler).handle(
Mockito.eq(data),
Mockito.any(HttpAsyncExchange.class),
Mockito.eq(exchangeContext));
this.protocolHandler.inputReady(conn, this.decoder);
Assert.assertEquals(MessageState.COMPLETED, state.getRequestState());
Assert.assertEquals(MessageState.INIT, state.getResponseState());
Assert.assertNotNull(state.getResponseProducer());
Mockito.verify(this.requestConsumer).consumeContent(this.decoder, this.conn);
Mockito.verify(this.requestConsumer).requestCompleted(exchangeContext);
Mockito.verify(this.conn).requestOutput();
}