Mockito.verify(this.conn, Mockito.never()).close();
}
@Test
public void testResponseContentCompletedNoKeepAlive() throws Exception {
final State state = new State();
state.setRequestState(MessageState.COMPLETED);
state.setResponseState(MessageState.BODY_STREAM);
final HttpContext exchangeContext = new BasicHttpContext();
final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
response.setEntity(new NStringEntity("stuff"));
final Outgoing outgoing = new Outgoing(
request, response, this.responseProducer, exchangeContext);
state.setOutgoing(outgoing);
this.connContext.setAttribute(HttpAsyncService.HTTP_EXCHANGE_STATE, state);
Mockito.when(this.encoder.isCompleted()).thenReturn(true);
Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(Boolean.FALSE);
this.protocolHandler.outputReady(conn, this.encoder);
Assert.assertEquals(MessageState.READY, state.getResponseState());
Mockito.verify(this.responseProducer).produceContent(this.encoder, this.conn);
Mockito.verify(this.responseProducer).responseCompleted(exchangeContext);
Mockito.verify(this.conn, Mockito.never()).requestInput();
Mockito.verify(this.conn).close();