SSL peer shut down incorrectly in Java

SSL peer shut down incorrectly in Java

That is a problem of security protocol. I am using TLSv1 but the host accept only TLSv1.1 and TLSv1.2 then I changed the protocol in Java with the instruction below:

System.setProperty(https.protocols, TLSv1.1);

You can set protocol versions in system property as :

overcome ssl handshake error

System.setProperty(https.protocols, TLSv1,TLSv1.1,TLSv1.2);

SSL peer shut down incorrectly in Java

Apart from the accepted answer, other problems can cause the exception too. For me it was that the certificate was not trusted (i.e., self-signed cert and not in the trust store).

If the certificate file does not exists, or could not be loaded (e.g., typo in path) can—in certain circumstances—cause the same exception.

Leave a Reply

Your email address will not be published.