use of io.vertx.core.http.HttpTestBase.DEFAULT_HTTP_HOST in project vert.x by eclipse.
the class JsonTest method testHttp.
@Test
public void testHttp() {
Vertx vertx = Vertx.vertx();
try {
vertx.createHttpServer().requestHandler(req -> {
req.response().end("hello");
}).listen(DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, onSuccess(s -> {
HttpClient client = vertx.createHttpClient();
client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, "/").compose(req -> req.send().compose(HttpClientResponse::body)).onComplete(onSuccess(body -> {
assertEquals("hello", body.toString());
testComplete();
}));
}));
await();
} finally {
vertx.close();
}
}
Aggregations