amitshekhariitbhu / Fast-Android-Networking

🚀 A Complete Fast Android Networking Library that also supports HTTP/2 🚀
https://outcomeschool.com
Apache License 2.0
5.71k stars 958 forks source link

Getting javax.net.ssl.SSLException: SSL handshake aborted Connection reset by peer while calling webservice Android #416

Open RiteshTops opened 5 years ago

RiteshTops commented 5 years ago

Hello Amit,

I am using com.amitshekhar.android:android-networking:1.0.2

Somtimes we are getting SSL handshake error in one plus , motorolla and samsund devices

Error Getting javax.net.ssl.SSLException: SSL handshake aborted Connection reset by peer while calling webservice Android

Please let me know How can I fix this issue?

RiteshTops commented 5 years ago

Can I implement this code? I am not sure if I will implement this solution then google playstore may reject application due to unsafeHTTPS call. So please let me know How can I fix this?

try {

 // Create a trust manager that does not validate certificate chains
 final TrustManager[] trustAllCerts = new TrustManager[] {

         new X509TrustManager() {

             @Override
             public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) { }
             @Override
             public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) {
             }
             @Override
             public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                 return new java.security.cert.X509Certificate[]{};
             }
         }
 };