In Android, an error occurs in the HTTP request "Your Ed authentication challenge is null" and the error message "Read timed out" is resolved.

Source: Internet
Author: User
Note: This article is from the blog "afei". If you want to repost this article, please contact the author! And indicate the source: http://blog.csdn.net/faye0412/article/details/7970155

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.