control.verify();
}
private HttpExchange setUpExchange() throws Exception {
HttpExchange exchange = control.createMock(HttpExchange.class);
expect(exchange.getHttpContext()).andReturn(context).anyTimes();
expect(exchange.getQueryString()).andReturn(null);
expect(exchange.getPathInfo()).andReturn(null);
expect(exchange.getRequestURI()).andReturn(CONTEXT_PATH);
expect(exchange.getContextPath()).andReturn(CONTEXT_PATH);
Map<String, List<String>> reqHeaders = new HashMap<String, List<String>>();
reqHeaders.put("Content-Type", Collections.singletonList("text/xml"));
expect(exchange.getRequestHeaders()).andReturn(reqHeaders).anyTimes();
OutputStream responseBody = control.createMock(OutputStream.class);
responseBody.flush();
EasyMock.expectLastCall();
expect(exchange.getResponseBody()).andReturn(responseBody).anyTimes();
observer.onMessage(isA(Message.class));
EasyMock.expectLastCall();
return exchange;
}