CompletionStage<HttpServer> serve(Vertx vertx) {
        HttpServer server = vertx.createHttpServer();
        Router router = Router.router(vertx);

        router.route()
                .handler(BodyHandler.create())
                .failureHandler(this::handleFailure);

        router.route(HttpMethod.GET, "/catalog/model/:kind/:name")
                .produces(MIME_TYPE_JSON)
                .blockingHandler(this::handleCatalogModel);

        router.route(HttpMethod.GET, "/catalog/capability/:name")
                .produces(MIME_TYPE_JSON)
                .blockingHandler(this::handleCatalogCapability);

        router.route(HttpMethod.POST, "/inspect/:location")
                .produces(MIME_TYPE_JSON)
                .blockingHandler(this::handleInspect);

        return server.requestHandler(router).listen(port, host).toCompletionStage();
    }
@Test
    public void testInspect() throws Exception {
        Agent agent = cmd();
        agent.port = 0;

        Vertx vertx = Vertx.vertx();
        HttpServer server = agent.serve(vertx).toCompletableFuture().get();

        try {
            int port = server.actualPort();
            String route = """
                    - route:
                        from:
                          uri: 'timer:tick'
                          steps:
                          - to: 'log:info'
                    """;

            RestAssured.given()
                    .baseUri("http://localhost")
                    .port(port)
                    .body(route)
                    .when()
                    .post("/inspect/routes.yaml")
                    .then()
                    .statusCode(200)
                    .body("resources.components", hasItems("timer", "log"));

        } finally {
            server.close();
            vertx.close();
        }
    }