MockWebServer[45678] connection from null failed: java.net.SocketException
生活随笔
收集整理的這篇文章主要介紹了
MockWebServer[45678] connection from null failed: java.net.SocketException
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
MockWebServer使用中的異常
MockWebServer: MockWebServer[45678] connection from null failed: java.net.SocketException: sendto failed: EBADF (Bad file number)
java.io.IOException: unexpected end of stream on Connection
Caused by: java.io.EOFException: \n not found: limit=0 content=…
解決
發(fā)現(xiàn)debug的時(shí)候有時(shí)可以成功響應(yīng),于是將測試方法所在的線程sleep
try {
Thread.currentThread().sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
成功響應(yīng)
原因猜測
多線程造成的
test方法所在線程執(zhí)行完畢,server服務(wù)器線程提前關(guān)閉了,但是數(shù)據(jù)沒有傳輸完成就結(jié)束了,所以就fauilre
總結(jié)
以上是生活随笔為你收集整理的MockWebServer[45678] connection from null failed: java.net.SocketException的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 100个寓言故事合集
- 下一篇: 好听霸气的网名122个