Hi Guys,
Running the following code almost ended with time out (I made sure the server always responds)
and nothing is printed to screen.
Changing the first
thenApply to
thenApplyAsync solves the problem.
I am not sure if this code is supported, and I'd appreciate it if someone can shed some light on this.
I am using AHC 2.10.0 on windows 7.
public static void main(String[] args) throws Exception {
AsyncHttpClient client = Dsl.asyncHttpClient();
client.prepareGet("http://google.com").execute()
.toCompletableFuture()
.thenApply(response -> client.prepareGet("http://google.com")
.execute()
.toCompletableFuture().join()
.getResponseBody())
.thenAccept(s -> System.out.println(s))
.exceptionally(t->{System.out.println(t.getMessage()); return null;});
Thread.sleep(1000000);
client.close();
}
Thanks
Avi