vertx 3.0 HttpClient simple TLS get request failing: SSLException: Inbound closed before...

642 views
Skip to first unread message

Hawkeye Parker

unread,
Jul 12, 2015, 4:37:50 AM7/12/15
to ve...@googlegroups.com

Hi,

Trying to make my first HTTPS request with the Vert.x HttpClient.  Like this:

HttpClient client = vertx.createHttpClient(new HttpClientOptions().setSsl(true).setTrustAll(true));

client
.get("httpbin.org", "/get", tokenResponse -> {
   
System.out.println("Received response with status code " + tokenResponse.statusCode());
    tokenResponse
.bodyHandler(bodyBuffer -> {
       
System.out.println(bodyBuffer.toString("UTF-8"));
   
});
}).end();


I never get a response.  Same request succeeds with plain HTTP, and I've successfully made the same HTTPS request with Apache HttpClient.  There is an HTTPS endpoint for the URL:  https://httpbin.org/get

Oddly, I'm not getting any stack trace, just:

Jul 12, 2015 12:45:21 AM io.vertx.core.http.impl.HttpClientImpl
SEVERE: javax.net.ssl.SSLHandshakeException: Failed to create SSL connection

I added -Djavax.net.debug=all, see full trace below.  Short:  the handshake fails early, soon after the initial ClientHello, [Raw write].  Eventually, I get the error:

javax.net.ssl.SSLException: Inbound closed before receiving peer's close_notify: possible truncation attack?

I'm not sure why the handshake is closing.  Full debug trace:

trigger seeding of SecureRandom
done seeding SecureRandom
Using SSLEngineImpl.
Ignoring unavailable cipher suite: TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
Ignoring unavailable cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
Ignoring unavailable cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
Ignoring unavailable cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256
Ignoring unavailable cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
Ignoring unavailable cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
Ignoring unavailable cipher suite: TLS_RSA_WITH_AES_256_GCM_SHA384
Ignoring unavailable cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
Ignoring unavailable cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
Ignoring unavailable cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
Ignoring unavailable cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
Ignoring unavailable cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
Ignoring unavailable cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
Ignoring unavailable cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
Deployment successful for: org.haughki.vertxtesting.TestVerticle
Allow unsafe renegotiation: false
Allow legacy hello messages: true
Is initial handshake: true
Is secure renegotiation: false
Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_128_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 for TLSv1.1
Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 for TLSv1.1
Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_128_CBC_SHA256 for TLSv1.1
Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 for TLSv1.1
Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 for TLSv1.1
Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 for TLSv1.1
Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 for TLSv1.1
%% No cached client session
*** ClientHello, TLSv1.2
RandomCookie:  GMT: 1419911462 bytes = { 219, 10, 0, 110, 169, 193, 23, 72, 91, 155, 103, 106, 87, 178, 167, 168, 152, 46, 190, 105, 240, 107, 225, 145, 123, 175, 195, 170 }
Session ID:  {}
Cipher Suites: [TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA, SSL_RSA_WITH_RC4_128_SHA, TLS_ECDH_ECDSA_WITH_RC4_128_SHA, TLS_ECDH_RSA_WITH_RC4_128_SHA, SSL_RSA_WITH_RC4_128_MD5, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
Compression Methods:  { 0 }
Extension elliptic_curves, curve names: {secp256r1, sect163k1, sect163r2, secp192r1, secp224r1, sect233k1, sect233r1, sect283k1, sect283r1, secp384r1, sect409k1, sect409r1, secp521r1, sect571k1, sect571r1, secp160k1, secp160r1, secp160r2, sect163r1, secp192k1, sect193r1, sect193r2, secp224k1, sect239k1, secp256k1}
Extension ec_point_formats, formats: [uncompressed]
Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA224withECDSA, SHA224withRSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA, MD5withRSA
Extension server_name, server_name: [type=host_name (0), value=httpbin.org]
***
[write] MD5 and SHA1 hashes:  len = 227
0000: 01 00 00 DF 03 03 55 A2   21 26 DB 0A 00 6E A9 C1  ......U.!&...n..
0010: 17 48 5B 9B 67 6A 57 B2   A7 A8 98 2E BE 69 F0 6B  .H[.gjW......i.k
0020: E1 91 7B AF C3 AA 00 00   46 C0 23 C0 27 00 3C C0  ........F.#.'.<.
0030: 25 C0 29 00 67 00 40 C0   09 C0 13 00 2F C0 04 C0  %.).g.@...../...
0040: 0E 00 33 00 32 C0 2B C0   2F 00 9C C0 2D C0 31 00  ..3.2.+./...-.1.
0050: 9E 00 A2 C0 08 C0 12 00   0A C0 03 C0 0D 00 16 00  ................
0060: 13 C0 07 C0 11 00 05 C0   02 C0 0C 00 04 00 FF 01  ................
0070: 00 00 70 00 0A 00 34 00   32 00 17 00 01 00 03 00  ..p...4.2.......
0080: 13 00 15 00 06 00 07 00   09 00 0A 00 18 00 0B 00  ................
0090: 0C 00 19 00 0D 00 0E 00   0F 00 10 00 11 00 02 00  ................
00A0: 12 00 04 00 05 00 14 00   08 00 16 00 0B 00 02 01  ................
00B0: 00 00 0D 00 1A 00 18 06   03 06 01 05 03 05 01 04  ................
00C0: 03 04 01 03 03 03 01 02   03 02 01 02 02 01 01 00  ................
00D0: 00 00 10 00 0E 00 00 0B   68 74 74 70 62 69 6E 2E  ........httpbin.
00E0: 6F 72 67                                           org
vert.x-eventloop-thread-2, WRITE: TLSv1.2 Handshake, length = 227
[Raw write]: length = 232
0000: 16 03 03 00 E3 01 00 00   DF 03 03 55 A2 21 26 DB  ...........U.!&.
0010: 0A 00 6E A9 C1 17 48 5B   9B 67 6A 57 B2 A7 A8 98  ..n...H[.gjW....
0020: 2E BE 69 F0 6B E1 91 7B   AF C3 AA 00 00 46 C0 23  ..i.k........F.#
0030: C0 27 00 3C C0 25 C0 29   00 67 00 40 C0 09 C0 13  .'.<.%.).g.@....
0040: 00 2F C0 04 C0 0E 00 33   00 32 C0 2B C0 2F 00 9C  ./.....3.2.+./..
0050: C0 2D C0 31 00 9E 00 A2   C0 08 C0 12 00 0A C0 03  .-.1............
0060: C0 0D 00 16 00 13 C0 07   C0 11 00 05 C0 02 C0 0C  ................
0070: 00 04 00 FF 01 00 00 70   00 0A 00 34 00 32 00 17  .......p...4.2..
0080: 00 01 00 03 00 13 00 15   00 06 00 07 00 09 00 0A  ................
0090: 00 18 00 0B 00 0C 00 19   00 0D 00 0E 00 0F 00 10  ................
00A0: 00 11 00 02 00 12 00 04   00 05 00 14 00 08 00 16  ................
00B0: 00 0B 00 02 01 00 00 0D   00 1A 00 18 06 03 06 01  ................
00C0: 05 03 05 01 04 03 04 01   03 03 03 01 02 03 02 01  ................
00D0: 02 02 01 01 00 00 00 10   00 0E 00 00 0B 68 74 74  .............htt
00E0: 70 62 69 6E 2E 6F 72 67                            pbin.org
vert.x-eventloop-thread-2, called closeOutbound()
vert.x-eventloop-thread-2, closeOutboundInternal()
vert.x-eventloop-thread-2, SEND TLSv1.2 ALERT:  warning, description = close_notify
vert.x-eventloop-thread-2, WRITE: TLSv1.2 Alert, length = 2
[Raw write]: length = 7
0000: 15 03 03 00 02 01 00                               .......
vert.x-eventloop-thread-2, called closeOutbound()
vert.x-eventloop-thread-2, closeOutboundInternal()
vert.x-eventloop-thread-2, called closeInbound()
vert.x-eventloop-thread-2, fatal error: 80: Inbound closed before receiving peer's close_notify: possible truncation attack?
javax.net.ssl.SSLException: Inbound closed before receiving peer's close_notify: possible truncation attack?
vert.x-eventloop-thread-2, SEND TLSv1.2 ALERT:  fatal, description = internal_error
vert.x-eventloop-thread-2, Exception sending alert: java.io.IOException: writer side was already closed.
Jul 12, 2015 1:11:19 AM io.vertx.core.http.impl.HttpClientImpl
SEVERE: javax.net.ssl.SSLHandshakeException: Failed to create SSL connection
vert.x-eventloop-thread-2, called closeOutbound()
vert.x-eventloop-thread-2, closeOutboundInternal()
vert.x-eventloop-thread-2, called closeInbound()
vert.x-eventloop-thread-2, closeInboundInternal()

Tim Fox

unread,
Jul 12, 2015, 5:56:25 AM7/12/15
to ve...@googlegroups.com
The default port for the HttpClient is 80, you probably need to set it to 443 if your server is listening on that port.

e.g.:

client.get("httpbin.org", 443, "/get", res -> {
});
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/5fe5707c-cc18-4f40-a340-8ae3cf8ae403%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hawkeye Parker

unread,
Jul 12, 2015, 4:13:17 PM7/12/15
to ve...@googlegroups.com
Yes, that's it, only:

client.get(443, "httpbin.org", "/get", res -> {
});

Many thanks!
Reply all
Reply to author
Forward
0 new messages