SimpleTestHttpClient httpClient = SimpleTestHttpClient.createLocal(TimeoutPolicy.ALL_TIMEOUTS);
SimpleHttpResponseHandler respHandler = httpClient.sendRequest(_serverAddress, httpRequest);
assertTrue("failed to get a response", respHandler.awaitResponseUninterruptedly(1, TimeUnit.SECONDS));
HttpResponse respObj = respHandler.getResponse();
if (expectFail)
{
assertNotNull("/stream failed to return expected error",
respObj.getHeader(DatabusHttpHeaders.DATABUS_ERROR_CLASS_HEADER));
}
else
{
assertNull("/stream returned unexpected error",
respObj.getHeader(DatabusHttpHeaders.DATABUS_ERROR_CLASS_HEADER));
}
if (LOG.isDebugEnabled())
{
LOG.debug("/stream response:" + new String(respHandler.getReceivedBytes()));