java.io.IOException: unexpected end of stream on okhttp3.Address

来源:互联网 发布:淘宝优惠券图标 编辑:程序博客网 时间:2024/05/22 11:36

在使用okhttp和retrofit访问网络的时候,今天测出来问题:

java.io.IOException: unexpected end of stream on okhttp3.Address@XXXX

后解决办法如下:

if (Build.VERSION.SDK != null && Build.VERSION.SDK_INT > 13) {            request = request.newBuilder()                    .removeHeader("encryptValue")                    .addHeader("encryptValue", key)                    .addHeader("Connection", "close")                    .build();        }

增加关闭连接即可

 .addHeader("Connection", "close")
阅读全文
0 0