-1

My code was working fine and I received data from the server but suddenly I got this error : javax.net.ssl.SSLException: Read error: ssl=0x717c368708: I/O error during system call, Connection reset by peer

also sometimes I got this error :

com.google.gson.stream.MalformedJsonException: 
Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $

I'm using retrofit

implementation 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
implementation 'com.squareup.retrofit2:converter-gson:2.0.0-beta4' 

and here is the init for it

 Retrofit retrofit = new Retrofit.Builder().baseUrl(baseUrl).
                addConverterFactory(GsonConverterFactory.create()).build();
 Api api = retrofit.create(Api.class);
 Call<ProfileResult> profileCallBack = api.getProfileData();
Amin
  • 463
  • 2
  • 11
  • 29
  • `Connection reset by peer` sounds like the server closed the connection on you. Your question does not include enough information to even guess at why. `MalformedJsonException` sounds like it sent you some bad json. Once again, your question does not include enough information. – greeble31 Dec 06 '19 at 00:48
  • I found the problem was in my ISP which redirects me to their website for displaying a message about internet consumption and stuck in that redirect, when I run the application using data or different WiFi it works fine! @greeble31 – Amin Dec 08 '19 at 07:24
  • @greeble31 do you think a handshake between me (user) and the server was established before this error happened? I'm trying everything I find on stackoverflow to solve my problem (```CertPathValidatorException : Trust anchor for certificate path not found```) and now I receive this error (```javax.net.ssl.SSLException: Read error: ssl=0x717c368708: I/O error during system call, Connection reset by peer```) and I can't figure it out if I made it worse or solved a part of my problem. Thank you! – Andrei Manolache Mar 03 '21 at 13:16
  • @AndreiManolache Debugging SSL problems can be quite involved, if the answers presently on SO don't work for you, you should post a new question for your specific circumstances. That's sure to get you pointed in the right direction. – greeble31 Mar 04 '21 at 00:14
  • @AndreiManolache also check this question too it may help! https://stackoverflow.com/questions/55992416/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-pa – Amin Mar 04 '21 at 01:19

1 Answers1

0

I found the problem was in my ISP which redirects me to their website for displaying a message about internet consumption and stuck in that redirect, when I run the application using data or different WiFi it works fine!

Amin
  • 463
  • 2
  • 11
  • 29