您的位置 首页 网络技术

Android HttpURLConnection throwing EOFException

Here’s the question in simplest way.

I create a HTTPS connection to my server through proxy using HttpUrlConnection Object.

My proxy closes the connection but my code still tries to reuse the same connection. And so I get EOFException.

How do I handle such cases?

I’d recommend disabling the http.keepalive system property. The performance section of the documentation indicates that socket connections will be reused when possible. It sounds like it is trying to reuse the connection, but the proxy has already closed it. On this post, Darrell also indicates that changing the system property solved his problem.

System.setProperty("http.keepAlive", "false");

猫叔总结了 适合新手操作的副业 《淘宝虚拟产品月入2万的 6个 细分类目》的电子书 仅供参考

如果你对虚拟产品比较感兴趣,可以点击:

淘宝卖什么虚拟产品赚钱(月入2万+)

花猫大叔

关于花猫大叔短视频创业 作者: 花猫大叔

热门文章