java.net.SocketTimeoutException в ohttp 2.7.5 + дооснащение 1.9.0 в основном в сотовых (4G / 3G / 2G) соединениях - PullRequest
0 голосов
/ 14 января 2019

Я пытался использовать

OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(1, TimeUnit.MINUTES); // connect timeout
client.setReadTimeout(1, TimeUnit.MINUTES);
client.setWriteTimeout(1, TimeUnit.MINUTES);
client.setConnectionPool(new ConnectionPool(0, 1,
TimeUnit.NANOSECONDS))

также добавлен android: vmSafeMode = "true" в манифесте. Но проблема все еще существует. Это проблема с okHttp или модернизацией. Пожалуйста, поделитесь своими мыслями. А также полезно ли увеличить время ожидания до 5 минут.

I/REST-LOG: java.net.SocketTimeoutException: timeout
at com.squareup.okhttp.internal.framed.FramedStream$StreamTimeout.newTimeou    tException(FramedStream.java:605)
at com.squareup.okhttp.internal.framed.FramedStream$StreamTimeout.exitAndTh    rowIfTimedOut(FramedStream.java:613)
at com.squareup.okhttp.internal.framed.FramedStream.getResponseHeaders(Fram    edStream.java:143)
at com.squareup.okhttp.internal.http.Http2xStream.readResponseHeaders(Http2    xStream.java:150)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEng    ine.java:737)
at com.squareup.okhttp.internal.http.HttpEngine.access$200(HttpEngine.java:    87)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.pro    ceed(HttpEngine.java:722)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.jav    a:576)
at com.squareup.okhttp.Call.getResponse(Call.java:287)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:2    43)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205)
at com.squareup.okhttp.Call.execute(Call.java:80)
at retrofit.client.OkClient.execute(OkClient.java:53)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
at java.lang.reflect.Proxy.invoke(Proxy.java:397)
at $Proxy16.sendPosition(Unknown Source)
...