1HttpClient client = HttpClient.newHttpClient();
2HttpRequest request = HttpRequest.newBuilder()
3 .uri(URI.create("http://openjdk.java.net/"))
4 .build();
5client.sendAsync(request, BodyHandlers.ofString())
6 .thenApply(HttpResponse::body)
7 .thenAccept(System.out::println)
8 .join();