title: HTTP Basic Authentication issue on Android Jelly Bean 4.1 using HttpURLConnection
body: <p>We are making HttpURLConnection based request to the Web server using HTTP Basic Authentication.
  Code works great on Android versions 2.x, 3.x., 4.0.x Now with Jelly Bean and v4.1.x authentication fails with the following messages in the LogCat:</p>
  
  <pre><code>01-27 10:54:18.886: ...::doReadRawData(731): An exception occured while reading data from remote host. httpURLConn.responseCode = 401 / httpURLConn.responseMessage = UNAUTHORIZED
  01-27 10:54:18.886: ...::doReadRawData(731): java.io.IOException: No authentication challenges found
  </code></pre>
  
  <p>The Authentication code we using for HttpURLConnection as in the Android documentation:</p>
  
  <pre><code>private void doAuthorize() {
          Authenticator.setDefault(new Authenticator() {
              protected PasswordAuthentication getPasswordAuthentication() {
                  return new PasswordAuthentication(USER, PASSWORD.toCharArray());
              }
          });
      }
  </code></pre>
  
  <p><strong>Upon further investigation and troubleshooting we found out that this code is not being called in 4.1 Jelly Bean!</strong></p>
  
  <p>What are the workarounds or proper ways for basic authentication in Android Jelly Bean 4.1?</p>
  
  <p>Someone found different in the Android source code in this related topic, I think issue we having is related to that difference: <a href="https://stackoverflow.com/questions/11810447/httpurlconnection-worked-fine-in-android-2-x-but-not-in-4-1-no-authentication-c">HttpURLConnection worked fine in Android 2.x but NOT in 4.1: No authentication challenges found</a></p>