찾다

 >  Q&A  >  본문

retrofit - android java.net.SocketTimeoutException timeout

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

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)

伊谢尔伦伊谢尔伦2802일 전1889

모든 응답(2)나는 대답할 것이다

  • ringa_lee

    ringa_lee2017-04-18 10:19:37

    서버 요청 시간이 초과되었나요?

    회신하다
    0
  • 大家讲道理

    大家讲道理2017-04-18 10:19:37

    실제로 연결 시간이 초과되었을 수 있습니다. 테스트하는 방법은 두 가지가 있습니다.
    1: HttpConnectionTimeOut 시간을 1분 정도 더 길게 설정하세요
    2: 일부 인터페이스 호출 도구(Chrome)를 사용할 수 있습니다. 브라우저의 Postman 플러그인)을 사용하여 인터페이스를 테스트하고 호출 결과를 살펴보세요. 호출이 정상이면 자신의 코드에 문제가 있는지 분석해 보세요

    회신하다
    0
  • 취소회신하다