}
}
@Test
public void testExchangeDone() throws Exception {
HttpExchange httpExchange = this.protocolHandler.new HttpExchange();
HttpRequest request = new BasicHttpRequest("GET", "/");
httpExchange.setRequest(request);
BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
httpExchange.setResponse(response);
httpExchange.setHandler(this.exchangeHandler);
this.connContext.setAttribute(HttpAsyncClientProtocolHandler.HTTP_EXCHANGE, httpExchange);
Mockito.when(this.exchangeHandler.isDone()).thenReturn(true);
Assert.assertEquals("request state: READY; request: GET / HTTP/1.1; " +
"response state: READY; response: HTTP/1.1 200 OK; valid: true;",
httpExchange.toString());
this.protocolHandler.requestReady(this.conn);
Assert.assertEquals(MessageState.READY, httpExchange.getRequestState());
Assert.assertEquals(MessageState.READY, httpExchange.getResponseState());
Assert.assertNull(httpExchange.getHandler());
}