Vert.x - Http Client

About

List

@Test
public void testRemoteInfo(TestContext context) {
	Async async = context.async();

	Promise<HttpResponse<JsonObject>> ipPromise = Promise.promise();
	webClient.get("/ip")
	  .as(BodyCodec.jsonObject())
	  .send(ipPromise);
	ipPromise.future().setHandler(ar -> {
	  if (ar.succeeded()) {
		HttpResponse<JsonObject> response = ar.result();
		Boolean success = response.body().getBoolean("success");
		context.assertEquals(true,success);
		context.assertEquals(response.statusCode(), 200);
		context.assertEquals(response.headers().get("content-type"), "application/json");
		async.complete();
	  } else {
		context.fail(ar.cause());
	  }
	});
	async.awaitSuccess(5000);
}

Powered by ComboStrap