SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder().setProviderClass(getProviderClass()).setRealmPrincipal(USER).setRealmPassword(ADMIN)
.setUrl(getTargetUrl()).setHeader("Content-Type", "text/html").build();
try {
StringBuilder s = new StringBuilder();
Future<Response> future = client.post(new InputStreamBodyGenerator(new ByteArrayInputStream(MY_MESSAGE.getBytes())), new AppendableBodyConsumer(s));
Response response = future.get();
assertEquals(response.getStatusCode(), 200);
assertEquals(s.toString(), MY_MESSAGE);
assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);