Mockito.verify(this.conn, Mockito.never()).close();
}
@Test
public void testResponseNotModified() throws Exception {
HttpExchange httpExchange = this.protocolHandler.new HttpExchange();
HttpContext exchangeContext = httpExchange.getContext();
BasicHttpRequest request = new BasicHttpRequest("HEAD", "/", HttpVersion.HTTP_1_1);
httpExchange.setRequest(request);
httpExchange.setRequestState(MessageState.COMPLETED);
httpExchange.setResponseProducer(this.responseProducer);
this.connContext.setAttribute(HttpAsyncServiceHandler.HTTP_EXCHANGE, httpExchange);
BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
HttpStatus.SC_NOT_MODIFIED, "Not modified");
response.setEntity(NStringEntity.create("stuff"));
Mockito.when(this.responseProducer.generateResponse()).thenReturn(response);
Mockito.when(this.reuseStrategy.keepAlive(response, exchangeContext)).thenReturn(true);
this.protocolHandler.responseReady(this.conn);
Assert.assertEquals(MessageState.READY, httpExchange.getRequestState());
Assert.assertEquals(MessageState.READY, httpExchange.getResponseState());
Mockito.verify(this.httpProcessor).process(response, exchangeContext);
Mockito.verify(this.conn).submitResponse(response);
Mockito.verify(this.responseProducer).responseCompleted(exchangeContext);
Mockito.verify(this.conn).requestInput();