Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8182589

TLS SNI in new Java 9 client is not available

    Details

    • Subcomponent:
    • Resolved In Build:
      b14
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+170-jigsaw-nightly-h6430-20170523)
      Java HotSpot(TM) 64-Bit Server VM (build 9-ea+170-jigsaw-nightly-h6430-20170523, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      Enabling TLS SNI extension in new Java 9 client seems not possible. (Package jdk.incubator.http)

      Related: https://stackoverflow.com/questions/44479678/enable-tls-sni-in-new-java-9-client


      ERROR MESSAGES/STACK TRACES THAT OCCUR :

      javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
      at java.base/sun.security.ssl.Alerts.getSSLException(Alerts.java:198)
      at java.base/sun.security.ssl.Alerts.getSSLException(Alerts.java:159)
      at java.base/sun.security.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1905)
      at java.base/sun.security.ssl.SSLEngineImpl.processInputRecord(SSLEngineImpl.java:1140)
      at java.base/sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1020)
      at java.base/sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:902)
      at java.base/sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:680)
      at java.base/javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:626)
      at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.unwrapBuffer(AsyncSSLDelegate.java:476)
      at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.handshakeReceiveAndUnWrap(AsyncSSLDelegate.java:395)
      at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.doHandshakeImpl(AsyncSSLDelegate.java:294)
      at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.doHandshakeNow(AsyncSSLDelegate.java:262)
      at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLDelegate.connect(AsyncSSLDelegate.java:233)
      at jdk.incubator.httpclient/jdk.incubator.http.AsyncSSLConnection.connect(AsyncSSLConnection.java:78)
      at jdk.incubator.httpclient/jdk.incubator.http.Http2Connection.<init>(Http2Connection.java:263)
      at jdk.incubator.httpclient/jdk.incubator.http.Http2ClientImpl.getConnectionFor(Http2ClientImpl.java:108)
      at jdk.incubator.httpclient/jdk.incubator.http.ExchangeImpl.get(ExchangeImpl.java:86)
      at jdk.incubator.httpclient/jdk.incubator.http.Exchange.establishExchange(Exchange.java:272)
      at jdk.incubator.httpclient/jdk.incubator.http.Exchange.responseImpl0(Exchange.java:283)
      at jdk.incubator.httpclient/jdk.incubator.http.Exchange.responseImpl(Exchange.java:260)
      at jdk.incubator.httpclient/jdk.incubator.http.Exchange.response(Exchange.java:136)
      at jdk.incubator.httpclient/jdk.incubator.http.MultiExchange.response(MultiExchange.java:154)
      at jdk.incubator.httpclient/jdk.incubator.http.HttpClientImpl.send(HttpClientImpl.java:234)
      at CheckProj/Main.Main.lambda$main$0(Main.java:42)
      at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714)
      at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
      at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)
      at jdk.incubator.httpclient/jdk.incubator.http.ResponseProcessors$ByteArrayProcessor.onComplete(ResponseProcessors.java:219)
      at jdk.incubator.httpclient/jdk.incubator.http.BlockingPushPublisher.acceptData(BlockingPushPublisher.java:65)
      at jdk.incubator.httpclient/jdk.incubator.http.AbstractPushPublisher.consume(AbstractPushPublisher.java:51)
      at jdk.incubator.httpclient/jdk.incubator.http.ResponseContent.pushBodyChunked(ResponseContent.java:238)
      at jdk.incubator.httpclient/jdk.incubator.http.ResponseContent.pushBody(ResponseContent.java:110)
      at jdk.incubator.httpclient/jdk.incubator.http.Http1Response.lambda$readBody$2(Http1Response.java:157)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1161)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      at java.base/java.lang.Thread.run(Thread.java:844)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      HttpClient client = HttpClient.newHttpClient();
      client.send(
             HttpRequest
                 .newBuilder(new URI("https://www.classy.org/"))
                 .GET()
                 .build(),
             HttpResponse.BodyHandler.asString());
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Using legacy HttpURLConnection class.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michaelm Michael McMahon
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: