【问题标题】:Retrofit ssl=0x717f870208: I/O error during system call, Connection reset by peer改造 ssl=0x717f870208:系统调用期间的 I/O 错误,对等方重置连接
【发布时间】:2019-12-08 15:23:58
【问题描述】:

我的代码工作正常,我从服务器接收到数据,但突然出现此错误: javax.net.ssl.SSLException: Read error: ssl=0x717c368708: I/O error during system call, Connection reset by peer

有时我也会遇到这个错误:

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

我正在使用改造

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

这是它的初始化

 Retrofit retrofit = new Retrofit.Builder().baseUrl(baseUrl).
                addConverterFactory(GsonConverterFactory.create()).build();
 Api api = retrofit.create(Api.class);
 Call<ProfileResult> profileCallBack = api.getProfileData();

【问题讨论】:

  • Connection reset by peer 听起来服务器关闭了你的连接。您的问题没有包含足够的信息,甚至无法猜测原因。 MalformedJsonException 听起来像是给你发送了一些糟糕的 json。再一次,您的问题没有包含足够的信息。
  • 我发现问题出在我的 ISP 中,它将我重定向到他们的网站以显示有关互联网消费的消息并停留在该重定向中,当我使用数据或其他 WiFi 运行应用程序时,它工作正常! @greeble31​​span>
  • @greeble31 你认为我(用户)和服务器之间的握手是在这个错误发生之前建立的吗?我正在尝试在 stackoverflow 上找到的所有东西来解决我的问题 (CertPathValidatorException : Trust anchor for certificate path not found),现在我收到了这个错误 (javax.net.ssl.SSLException: Read error: ssl=0x717c368708: I/O error during system call, Connection reset by peer),我不知道是我让它变得更糟还是解决了我的问题的一部分。谢谢!
  • @AndreiManolache 调试 SSL 问题可能相当复杂,如果目前关于 SO 的答案对您不起作用,您应该针对您的具体情况发布一个新问题。这一定会让你指向正确的方向。
  • @AndreiManolache 也检查这个问题,它可能会有所帮助! stackoverflow.com/questions/55992416/…

标签: android android-studio ssl-certificate retrofit


【解决方案1】:

我发现问题出在我的 ISP 中,它将我重定向到他们的网站以显示有关互联网消费的消息并停留在该重定向中,当我使用数据或其他 WiFi 运行应用程序时,它工作正常!

【讨论】:

    猜你喜欢
    • 2015-06-03
    • 2019-11-23
    • 2015-08-12
    • 2015-03-29
    • 2021-01-01
    • 2016-05-29
    • 2020-03-07
    • 2018-02-09
    • 2016-08-01
    相关资源
    最近更新 更多