title: Java Async HttpClient request seems to block the main thread?
body: <p>According to <a href="https://openjdk.java.net/groups/net/httpclient/intro.html" rel="nofollow noreferrer">this</a> the following snippet should be Async.</p>
  <p>Therefore, the output should read: TP1, TP2, TP3, <a href="http://openjdk.java.net/" rel="nofollow noreferrer">http://openjdk.java.net/</a>.</p>
  <p>However, when I run it I get: TP1, TP2, <a href="http://openjdk.java.net/" rel="nofollow noreferrer">http://openjdk.java.net/</a>, TP3.</p>
  <p>It seems &quot;sendAsync&quot; is blocking the main thread. This is not what I expected from an Async method.</p>
  <p>Am I doing something wrong?</p>
  <pre><code> public static void main(String[] args) {
  
      HttpClient client = HttpClient.newHttpClient();
  
      System.out.println(&quot;TP1&quot;);
  
      HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create(&quot;http://openjdk.java.net/&quot;))
              .build();
  
      System.out.println(&quot;TP2&quot;);
  
      client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
              .thenApply(HttpResponse::uri)
              .thenAccept(System.out::println)
              .join();
  
      System.out.println(&quot;TP3&quot;);
  
  }
  </code></pre>