Server server = new Server(dh);
server.start();
HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
IHttpResponse response = con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
Assert.assertEquals(200, response.getStatus());
QAUtil.sleep(1000);
NonBlockingBodyDataSource dataSource = response.getNonBlockingBody();
BodyDataHandler dataHandler = new BodyDataHandler();
dataSource.setDataHandler(dataHandler);
QAUtil.sleep(500);
Assert.assertNull(dataHandler.exceptionRef.get());
Assert.assertEquals("123", dataHandler.dataRef.get());
dataSource.close();
QAUtil.sleep(500);
Assert.assertFalse(con.isOpen());
QAUtil.sleep(500);
Assert.assertNotNull(dataHandler.exceptionRef.get());
server.close();