@Test
public void start_http_server(TestContext context) {
Async async = context.async();
vertx.createHttpServer().requestHandler(req ->
req.response().putHeader("Content-Type", "text/plain").end("Ok"))
WebClient webClient = WebClient.create(vertx);
webClient.get(8080, "localhost", "/").send(ar -> {
if (ar.succeeded()) {
HttpResponse<Buffer> response = ar.result();
context.assertTrue(response.headers().contains("Content-Type"));
context.assertEquals("text/plain", response.getHeader("Content-Type"));
webClient.close();
async.complete();
} else {
async.resolve(Promise.failedPromise(ar.cause()));
}
});
}));