use of reactor.ipc.netty.channel.AbortedException in project reactor-netty by reactor.
the class HttpClientTest method pipelined.
@Test
@Ignore
public void pipelined() throws Exception {
NettyContext x = TcpServer.create("localhost", 0).newHandler((in, out) -> out.context(c -> c.addHandlerFirst(new HttpResponseEncoder())).sendObject(Flux.just(response(), response())).neverComplete()).block(Duration.ofSeconds(30));
PoolResources pool = PoolResources.fixed("test", 1);
HttpClient.create(opts -> opts.host("localhost").port(x.address().getPort()).poolResources(pool)).get("/").flatMap(r -> {
r.dispose();
return Mono.just(r.status().code());
}).log().block(Duration.ofSeconds(30));
try {
HttpClient.create(opts -> opts.host("localhost").port(x.address().getPort()).poolResources(pool)).get("/").log().block(Duration.ofSeconds(30));
} catch (AbortedException ae) {
return;
}
x.dispose();
pool.dispose();
Assert.fail("Not aborted");
}
use of reactor.ipc.netty.channel.AbortedException in project reactor-netty by reactor.
the class TcpClientTests method connectionWillAttemptToReconnectWhenItIsDropped.
@Test
public void connectionWillAttemptToReconnectWhenItIsDropped() throws InterruptedException, IOException {
final CountDownLatch connectionLatch = new CountDownLatch(1);
final CountDownLatch reconnectionLatch = new CountDownLatch(1);
try {
TcpClient tcpClient = TcpClient.create(opts -> opts.host("localhost").port(abortServerPort).disablePool());
Mono<? extends NettyContext> handler = tcpClient.newHandler((in, out) -> {
System.out.println("Start");
connectionLatch.countDown();
in.receive().subscribe();
return Flux.never();
});
handler.log().block(Duration.ofSeconds(30)).onClose().then(handler.doOnSuccess(s -> reconnectionLatch.countDown())).block(Duration.ofSeconds(30));
assertTrue("Initial connection is made", connectionLatch.await(5, TimeUnit.SECONDS));
assertTrue("A reconnect attempt was made", reconnectionLatch.await(5, TimeUnit.SECONDS));
} catch (AbortedException ise) {
return;
}
}
Aggregations