0
임 안드로이드 (8) (26 오레오) 내 서버에서 데이터를 가져 오기 위해 노력하고 나는 다음과 같은 오류 얻을 : 개조 2.3.0을 사용하여개조 + OkHttp - ProtocolException 사용
java.net.ProtocolException: unexpected end of stream
임, OkHttp 3.9.0. 이상한 점은이 오류가 API 26 Oreo에서만 발생하며 이전 API에서는 발생하지 않는다는 것입니다.이 오류는 무작위로, 때로는 예, 가끔씩 발생합니다. RxJava 디버깅 기능으로 인해 오류가 짧습니다.
편집 : 나는 간단한 전화 "요청"이 전체 오류가 함께 RxJava을 변경 :
java.net.ProtocolException: unexpected end of stream
at okhttp3.internal.http1.Http1Codec$FixedLengthSource.read(Http1Codec.java:398)
at okio.RealBufferedSource.readAll(RealBufferedSource.java:163)
at retrofit2.Utils.buffer(Utils.java:304)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:204)
at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:112)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:153)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
내가 만드는 전화는 꽤 표준입니다 :
TestInterface api = retrofit.create(TestInterface.class);
Call<List<Post>> call = api.getFeed(0, 0, "9");
call.enqueue(new Callback<List<Post>>() {
@Override
public void onResponse(Call<List<Post>> call, Response<List<Post>> response) {
Log.i(TAG, "[app] onResponse");
}
@Override
public void onFailure(Call<List<Post>> call, Throwable t) {
Log.i(TAG, "[app] onFailure: ", t);
}
});
이 나의 응답이다 헤더의 내용 길이를 확인한 결과 내 응답과 일치했습니다.
Allow →GET, HEAD, OPTIONS
Connection →close
Content-Language →en
Content-Length →3277
Content-Type →application/json
Date →Sat, 09 Sep 2017 14:58:38 GMT
Server →gunicorn/19.7.0
Vary →Accept, Accept-Language, Cookie
X-Frame-Options →SAMEORIGIN
덕분에 그것을 시도 할 것이다! – box
작동하지 않음 .... – box