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

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

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伐。

membalas semua(2)
左手右手慢动作

服务器请求超时了吧

大家讲道理

有可能是真的连接超时,有两种方案来测试一下
1:把HttpConnectionTimeOut时间设置的长一点,比如一分钟
2:可以使用一些接口调用工具(Chrome浏览器的Postman插件)进行接口的测试,看一下调用结果,如果调用正常,就再分析看看是不是自己代码的问题

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!