@Test public void shouldNotConnectRelativeUri() { VertxClientHttpConnector connector = new VertxClientHttpConnector(mockVertx); Mono<ClientHttpResponse> result = connector.connect(GET, URI.create("/test"), r -> Mono.empty()); StepVerifier.create(result) .verifyErrorMessage("URI is not absolute: /test"); }
@Override public Mono<ClientHttpResponse> connect(org.springframework.http.HttpMethod method, URI uri, Function<? super ClientHttpRequest, Mono<Void>> requestCallback) { logger.debug("Connecting to '{}' with '{}", uri, method); if (!uri.isAbsolute()) { return Mono.error(new IllegalArgumentException("URI is not absolute: " + uri)); } CompletableFuture<ClientHttpResponse> responseFuture = new CompletableFuture<>(); HttpClient client = vertx.createHttpClient(clientOptions); HttpClientRequest request = client.requestAbs(HttpMethod.valueOf(method.name()), uri.toString()) .exceptionHandler(responseFuture::completeExceptionally) .handler(response -> { Flux<DataBuffer> responseBody = responseToFlux(response) .doFinally(ignore -> client.close()); responseFuture.complete(new VertxClientHttpResponse(response, responseBody)); }); return requestCallback.apply(new VertxClientHttpRequest(request, bufferConverter)) .then(Mono.fromCompletionStage(responseFuture)); }
VertxClientHttpConnector implements ClientHttpConnector { @Override public Mono<ClientHttpResponse> connect(org.springframework.http.HttpMethod method, URI uri, Function<? super ClientHttpRequest, Mono<Void>> requestCallback) { logger.debug("Connecting to '{}' with '{}", uri, method); if (!uri.isAbsolute()) { return Mono.error(new IllegalArgumentException("URI is not absolute: " + uri)); } CompletableFuture<ClientHttpResponse> responseFuture = new CompletableFuture<>(); HttpClient client = vertx.createHttpClient(clientOptions); HttpClientRequest request = client.requestAbs(HttpMethod.valueOf(method.name()), uri.toString()) .exceptionHandler(responseFuture::completeExceptionally) .handler(response -> { Flux<DataBuffer> responseBody = responseToFlux(response) .doFinally(ignore -> client.close()); responseFuture.complete(new VertxClientHttpResponse(response, responseBody)); }); return requestCallback.apply(new VertxClientHttpRequest(request, bufferConverter)) .then(Mono.fromCompletionStage(responseFuture)); } }
VertxClientHttpConnector implements ClientHttpConnector { @Override public Mono<ClientHttpResponse> connect(org.springframework.http.HttpMethod method, URI uri, Function<? super ClientHttpRequest, Mono<Void>> requestCallback) { logger.debug("Connecting to '{}' with '{}", uri, method); if (!uri.isAbsolute()) { return Mono.error(new IllegalArgumentException("URI is not absolute: " + uri)); } CompletableFuture<ClientHttpResponse> responseFuture = new CompletableFuture<>(); HttpClient client = vertx.createHttpClient(clientOptions); HttpClientRequest request = client.requestAbs(HttpMethod.valueOf(method.name()), uri.toString()) .exceptionHandler(responseFuture::completeExceptionally) .handler(response -> { Flux<DataBuffer> responseBody = responseToFlux(response) .doFinally(ignore -> client.close()); responseFuture.complete(new VertxClientHttpResponse(response, responseBody)); }); return requestCallback.apply(new VertxClientHttpRequest(request, bufferConverter)) .then(Mono.fromCompletionStage(responseFuture)); } VertxClientHttpConnector(Vertx vertx);  VertxClientHttpConnector(Vertx vertx, HttpClientOptions options); }
VertxClientHttpConnector implements ClientHttpConnector { @Override public Mono<ClientHttpResponse> connect(org.springframework.http.HttpMethod method, URI uri, Function<? super ClientHttpRequest, Mono<Void>> requestCallback) { logger.debug("Connecting to '{}' with '{}", uri, method); if (!uri.isAbsolute()) { return Mono.error(new IllegalArgumentException("URI is not absolute: " + uri)); } CompletableFuture<ClientHttpResponse> responseFuture = new CompletableFuture<>(); HttpClient client = vertx.createHttpClient(clientOptions); HttpClientRequest request = client.requestAbs(HttpMethod.valueOf(method.name()), uri.toString()) .exceptionHandler(responseFuture::completeExceptionally) .handler(response -> { Flux<DataBuffer> responseBody = responseToFlux(response) .doFinally(ignore -> client.close()); responseFuture.complete(new VertxClientHttpResponse(response, responseBody)); }); return requestCallback.apply(new VertxClientHttpRequest(request, bufferConverter)) .then(Mono.fromCompletionStage(responseFuture)); } VertxClientHttpConnector(Vertx vertx);  VertxClientHttpConnector(Vertx vertx, HttpClientOptions options); @Override Mono<ClientHttpResponse> connect(org.springframework.http.HttpMethod method, URI uri,
        Function<? super ClientHttpRequest, Mono<Void>> requestCallback); }
VertxClientHttpConnector implements ClientHttpConnector { @Override public Mono<ClientHttpResponse> connect(org.springframework.http.HttpMethod method, URI uri, Function<? super ClientHttpRequest, Mono<Void>> requestCallback) { logger.debug("Connecting to '{}' with '{}", uri, method); if (!uri.isAbsolute()) { return Mono.error(new IllegalArgumentException("URI is not absolute: " + uri)); } CompletableFuture<ClientHttpResponse> responseFuture = new CompletableFuture<>(); HttpClient client = vertx.createHttpClient(clientOptions); HttpClientRequest request = client.requestAbs(HttpMethod.valueOf(method.name()), uri.toString()) .exceptionHandler(responseFuture::completeExceptionally) .handler(response -> { Flux<DataBuffer> responseBody = responseToFlux(response) .doFinally(ignore -> client.close()); responseFuture.complete(new VertxClientHttpResponse(response, responseBody)); }); return requestCallback.apply(new VertxClientHttpRequest(request, bufferConverter)) .then(Mono.fromCompletionStage(responseFuture)); } VertxClientHttpConnector(Vertx vertx);  VertxClientHttpConnector(Vertx vertx, HttpClientOptions options); @Override Mono<ClientHttpResponse> connect(org.springframework.http.HttpMethod method, URI uri,
        Function<? super ClientHttpRequest, Mono<Void>> requestCallback);  }