use of reactor.netty.http.client.HttpClient in project pinpoint by naver.
the class ReactorNettyPluginTestController method clientPost.
@RequestMapping(value = "/client/post", method = RequestMethod.GET)
@ResponseBody
public String clientPost() {
HttpClient client = HttpClient.create().port(80);
HttpClientResponse response = client.post().uri("https://www.google.com/").send(ByteBufFlux.fromString(Mono.just("hello"))).response().block();
return response.toString();
}
use of reactor.netty.http.client.HttpClient in project pinpoint by naver.
the class ReactorNettyPluginTestController method clientGet.
@RequestMapping(value = "/client/get", method = RequestMethod.GET)
@ResponseBody
public String clientGet() {
HttpClient client = HttpClient.create().port(80);
String response = client.get().uri("https://www.google.com?foo=bar").responseContent().aggregate().asString().block();
return response;
}
use of reactor.netty.http.client.HttpClient in project pinpoint by naver.
the class ReactorNettyPluginTestController method clientError.
@RequestMapping(value = "/client/local", method = RequestMethod.GET)
@ResponseBody
public String clientError(HttpServletRequest request) {
HttpClient client = HttpClient.create().port(request.getLocalPort());
String response = client.get().uri("/client/echo").responseContent().aggregate().asString().block();
return response;
}
use of reactor.netty.http.client.HttpClient in project pinpoint by naver.
the class ReactorNettyPluginTestController method clientError.
@RequestMapping(value = "/client/unknown", method = RequestMethod.GET)
@ResponseBody
public String clientError() {
HttpClient client = HttpClient.create().port(80);
String response = client.get().uri("http://fjalkjdlfaj.com").responseContent().aggregate().asString().block();
return response;
}
use of reactor.netty.http.client.HttpClient in project spring-boot by spring-projects.
the class AbstractReactiveWebServerFactoryTests method prepareCompressionTest.
protected WebClient prepareCompressionTest(Compression compression, String responseContentType) {
AbstractReactiveWebServerFactory factory = getFactory();
factory.setCompression(compression);
this.webServer = factory.getWebServer(new CharsHandler(3000, responseContentType));
this.webServer.start();
HttpClient client = HttpClient.create().wiretap(true).compress(true).doOnConnected((connection) -> connection.channel().pipeline().addBefore(NettyPipeline.HttpDecompressor, "CompressionTest", new CompressionDetectionHandler()));
return getWebClient(client, this.webServer.getPort()).build();
}
Aggregations