try {
DummyServer server = new DummyServer(port);
server.start();
// Make a new POST Request.
Request manualRequest = new Request(config, null, HttpMethod.POST); // construct the Request
// Configure the request
manualRequest.setBody(body); // set the request body to send to the server
manualRequest.addObserver(requestObserver); // Add the requestObserver to the request's set of Observers
// Send the request!
manualRequest.send();
synchronized (requestObserver) {
requestObserver.wait(2000);
}
//assertEquals(true, (body+"\n").equals(manualRequest.getResponse().getBody()));
assertEquals(200, manualRequest.getResponse().getStatusCode());
assertEquals(true, "OK".equalsIgnoreCase(manualRequest.getResponse().getStatusMessage()));
assertTrue(body.equals(server.getLastReceived().getBody()));
assertEquals(manualRequest.getHttpMethod(), server.getLastReceived().getHttpMethod());
server.stop();
} //TODO switch to https
catch (InterruptedException e) {
// TODO Auto-generated catch block