I'm using Jackson's ObjectMapper class to make a request to a URL. This is working fine on my local machine (Mac), but is failing from my Unix VM. The difference is that my VM is behind a firewall, and my mac is not. However, both machines have access to the same proxy.
Seems like there might be some SSL issue involved. Can anyone spot the issue?
Using the following system properties in both deployments:
System.setProperty("http.proxyHost", _config.getProxyHost());
System.setProperty("http.proxyPort", _config.getProxyPort());
System.setProperty("https.proxyHost", _config.getProxyHost());
System.setProperty("https.proxyPort", _config.getProxyPort());
Here is the full stacktrace from the unix box:
Exception in thread "main" java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:189)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1343)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1511)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at java.net.URL.openStream(URL.java:1038)
at com.fasterxml.jackson.core.JsonFactory._optimizedStreamFromURL(JsonFactory.java:1420)
at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:730)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2137)
And when I am using: -Djavax.net.debug=ssl I see the following:
main, WRITE: TLSv1.2 Handshake, length = 286
main, handling exception: java.net.SocketException: Connection reset
main, SEND TLSv1.2 ALERT: fatal, description = unexpected_message
main, WRITE: TLSv1.2 Alert, length = 2
main, Exception sending alert: java.net.SocketException: Broken pipe
main, called closeSocket()
The difference is that my VM is behind a firewall, and my mac is not. However, both machines have access to the same proxy.
main, handling exception: java.net.SocketException: Connection reset
The peer closed the connection inside the handshake. Given that the difference between the working and non-working version is a firewall in between this firewall is probably blocking access, i.e. the connection reset is issued by the firewall.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With