import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServer; import io.vertx.core.json.JsonObject; import io.vertx.ext.web.Route; import io.vertx.ext.web.Router; import io.vertx.ext.web.client.WebClient; import java.util.concurrent.atomic.AtomicReference; public class NotMigrator { final private static int PORT_TDG = 8181; final private static int PORT_MY = 8080; final private static String HOST = "localhost"; final private static String TOKEN = "9f226286-e0d8-4125-ad43-b123b4e464da"; final private static String TYPE = "application/json;charset=utf-8"; final private static String PATH = "/api/migrate/graphql"; public static void main(String[] args) throws Exception { Vertx vertx = Vertx.vertx(); HttpServer server = vertx.createHttpServer(); Router router = Router.router(vertx); WebClient client = WebClient.create(vertx); router .get(PATH) .respond(ctx -> Future.succeededFuture(new JsonObject().put("hello", "world"))); server.requestHandler(router).listen(8080); } public void get(WebClient client) { client .post(PORT_TDG, HOST, "/graphql") .putHeader("Content-Type", "application/json") .sendJsonObject( new JsonObject() .put("query", "{Book(first: 100) { uuid, book_name, author }}") ) .onSuccess(res -> { if (res.statusCode() == 200 && res.getHeader("content-type").equals(TYPE)) { JsonObject body = res.bodyAsJsonObject(); //объект json } }); } }