title: How can I set authenticated http proxy for android device network?
body: <p>How can I rout an android device's internet through an authenticated http proxy (username and password) by changing the proxy settings?</p>
  <p>My current code is as follows (username, password, host, port are defined variables:</p>
  <pre><code>                Authenticator.setDefault(
                          new Authenticator() {
                              @Override
                              public PasswordAuthentication getPasswordAuthentication() {
                                  return new PasswordAuthentication(
                                          username, password.toCharArray());
                              }
                          }
                  );
  
                  System.setProperty(&quot;http.proxyUser&quot;, username);
                  System.setProperty(&quot;http.proxyPassword&quot;, password);
                  System.setProperty(&quot;https.proxyUser&quot;, username);
                  System.setProperty(&quot;https.proxyPassword&quot;, password );
  
                  System.setProperty(&quot;http.proxyHost&quot;, host);
                  System.setProperty(&quot;http.proxyPort&quot;, port);
  </code></pre>
  <p>It does not seem to connect, nor does it show any comprehensible error message.</p>