I am getting the exception as stated in the title of the question, while connecting to server using HTTPS in Java using HttpsURLConnection
class. Also I am trying to skip the certificate validation using the second last answer. What can I try next?
Update 1: Stack trace
javax.net.ssl.SSLException: Received fatal alert: bad_record_mac at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190) at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1720) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1165) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1149) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166) at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:133) at com.kuliza.sitepulse.thread.HttpConnectionThread.run(HttpConnectionThread.java:77) at java.lang.Thread.run(Thread.java:662)
I am getting the exception for the line of code: http.connect();
where http
is of the type HttpsURLConnection
class.
Update 2: SSL log
Here are the SSL Handshake logs:
[Raw read]: length = 50000: 15 03 00 00 02 .....[Raw read]: length = 20000: 02 14 ..Thread-6, READ: SSLv3 Alert, length = 2Thread-6, RECV SSLv3 ALERT: fatal, bad_record_macThread-6, called closeSocket()