These two days, I suddenly received the Test Team and told the company that the Android client should be used on some mobile phones with the following exceptions, some of which were running well and were very strange:
1) HttpUtils/getInputStream failed, e: Received authentication challenge is null
PS: The application request uses HttpConnection in Java instead of HttpClient.
Later, tests on multiple mobile phones showed that such a problem exists and appeared on android v4.04. Later, I checked the information and found that many people encountered similar problems, such:
1) http://d.hatena.ne.jp/Kazzz/20100706/p1
2) http://www.cnblogs.com/slider/archive/2012/07/16/2593816.html
In addition, we all use HttpConnection in Java, which occurs when requesting authentication. Later, it was discovered that the server returned a 401 error (for example, when the user name and password are incorrect ). This is also a jdk bug. I found this bug in buglist. But I don't know how to solve it. So I replaced HttpConnection with HttpClient, and the result showed the following exception:
1) W/System. err (18984): java.net. SocketTimeoutException: Read timed out
So I began to fall into another trap. After various tests, I found that it was setSoTimeout (params, 0) in HttpClient. I set it to 4 s, later, I changed it to 20 s (this value occasionally causes problems), and then I set it to 0 to solve the problem.
It took me too much time to solve this problem... Record it here and give a reference to friends who have encountered the same problem.