use of io.netty.handler.codec.http.HttpClientCodec in project reactor-netty by reactor.
the class HttpServerTests method testIssue825.
@Test
void testIssue825() throws Exception {
disposableServer = createServer().handle((req, resp) -> resp.sendString(Mono.just("test"))).bindNow();
DefaultFullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/");
CountDownLatch latch = new CountDownLatch(1);
Connection client = TcpClient.create().port(disposableServer.port()).handle((in, out) -> {
in.withConnection(x -> x.addHandlerFirst(new HttpClientCodec())).receiveObject().ofType(DefaultHttpContent.class).as(ByteBufFlux::fromInbound).subscribe(ReferenceCounted::release, t -> latch.countDown(), null);
return out.sendObject(Flux.just(request)).neverComplete();
}).wiretap(true).connectNow();
assertThat(latch.await(30, TimeUnit.SECONDS)).isTrue();
client.disposeNow();
}
Aggregations