retrofit - android java.net.SocketTimeoutException timeout
伊谢尔伦
伊谢尔伦 2017-04-18 10:17:37
0
2
1886

能否帮忙分析下抛出这个的原因,代码如下:

09-22 17:35:59.644 20596-20596/com.android W/System.err: java.net.SocketTimeoutException: timeout
09-22 17:35:59.649 20596-20596/com.android W/System.err: at okio.Okio$3.newTimeoutException(Okio.java:212)
09-22 17:35:59.649 20596-20596/com.android W/System.err: at okio.AsyncTimeout.exit(AsyncTimeout.java:277)
09-22 17:35:59.649 20596-20596/com.android W/System.err: at okio.AsyncTimeout$2.read(AsyncTimeout.java:244)
09-22 17:35:59.649 20596-20596/com.android W/System.err: at okio.RealBufferedSource.read(RealBufferedSource.java:45)
09-22 17:35:59.649 20596-20596/com.android W/System.err: at okhttp3.internal.http.Http1xStream$FixedLengthSource.read(Http1xStream.java:381)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at okio.RealBufferedSource.read(RealBufferedSource.java:45)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at okio.ForwardingSource.read(ForwardingSource.java:35)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at retrofit2.OkHttpCall$ExceptionCatchingRequestBody$1.read(OkHttpCall.java:279)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at okio.RealBufferedSource.request(RealBufferedSource.java:66)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at com.squareup.moshi.BufferedSourceJsonReader.nextNonWhitespace

(BufferedSourceJsonReader.java:933)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at com.squareup.moshi.BufferedSourceJsonReader.doPeek

(BufferedSourceJsonReader.java:327)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at com.squareup.moshi.BufferedSourceJsonReader.peek

(BufferedSourceJsonReader.java:202)
09-22 17:35:59.650 20596-20596/com.android W/System.err: at com.squareup.moshi.JsonAdapter$1.fromJson(JsonAdapter.java:65)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:33)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at retrofit2.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:33)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at retrofit2.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:23)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:117)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:211)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:106)
09-22 17:35:59.651 20596-20596/com.android W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:133)
09-22 17:35:59.652 20596-20596/com.android W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
09-22 17:35:59.652 20596-20596/com.android W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
09-22 17:35:59.652 20596-20596/com.android W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
09-22 17:35:59.652 20596-20596/com.android W/System.err: at java.lang.Thread.run(Thread.java:818)

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
左手右手慢动作

The server request has timed out

大家讲道理

It may be that the connection is really timed out. There are two options to test it
1: Set the HttpConnectionTimeOut time longer, such as one minute
2: You can use some interface calling tools (Postman plug-in of Chrome browser) to interface Test and look at the call result. If the call is normal, analyze it to see if it is a problem with your own code

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template