我们有一个现有的Android应用程序,使用Retrofit连接服务器并发送和接收JSON。自从我将设备更新到Android 4.4.4之后,在尝试连接时会出现以下错误:
D/Retrofit(8004): javax.net.ssl.SSLException: Read error: ssl=0x768c5c40: I/O error during system call, Connection reset by peer
D/Retrofit(8004): at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method)
D/Retrofit(8004): at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:689)
D/Retrofit(8004): at okio.Okio$2.read(Okio.java:136)
D/Retrofit(8004): at okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
D/Retrofit(8004): at okio.RealBufferedSource.indexOf(RealBufferedSource.java:244)
D/Retrofit(8004): at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:191)
D/Retrofit(8004): at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:189)
D/Retrofit(8004): at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101)
D/Retrofit(8004): at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:676)
D/Retrofit(8004): at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:426)
D/Retrofit(8004): at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:371)
D/Retrofit(8004): at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:466)
D/Retrofit(8004): at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
D/Retrofit(8004): at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
D/Retrofit(8004): at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
D/Retrofit(8004): at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
D/Retrofit(8004): at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
D/Retrofit(8004): at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
D/Retrofit(8004): at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
D/Retrofit(8004): at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
D/Retrofit(8004): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
D/Retrofit(8004): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
D/Retrofit(8004): at retrofit.Platform$Android$2$1.run(Platform.java:142)
D/Retrofit(8004): at java.lang.Thread.run(Thread.java:841)
我已经更新了Retrofit/OkHTTP和Okio的最新版本,但错误仍然存在。我猜想这可能与Android 4.4.4中包含的OpenSSL补丁有关,但我找不到解决此错误的方法。
是否有其他人遇到过这个问题,并找到了解决方法?
谢谢。
Rich