Mockito.verify(this.conn, Mockito.never()).close();
}
@Test
public void testResponseContentCompletedNoKeepAlive() throws Exception {
HttpExchange httpExchange = this.protocolHandler.new HttpExchange();
HttpContext exchangeContext = httpExchange.getContext();
BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
response.setEntity(NStringEntity.create("stuff"));
httpExchange.setRequestState(MessageState.COMPLETED);
httpExchange.setResponseState(MessageState.BODY_STREAM);
httpExchange.setResponse(response);
httpExchange.setResponseProducer(this.responseProducer);
this.connContext.setAttribute(HttpAsyncServiceHandler.HTTP_EXCHANGE, httpExchange);
Mockito.when(this.encoder.isCompleted()).thenReturn(true);
Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(false);
this.protocolHandler.outputReady(conn, this.encoder);
Assert.assertEquals(MessageState.READY, httpExchange.getRequestState());
Assert.assertEquals(MessageState.READY, httpExchange.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();