code: public void setHttpProxy(String host, int port) {
          if (host == null) {
              this.proxy = null;
          } else {
              this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
          }
      }
docs: Set your proxy information, if your proxy server requires authentication set a
  default Authenticator in your code:
  <p>
  Authenticator authenticator = new Authenticator() {
  <p>
  public PasswordAuthentication getPasswordAuthentication() {
  return (new PasswordAuthentication("user",
  "password".toCharArray()));
  }
  };
  Authenticator.setDefault(authenticator);
  <p>
  This will allow different proxy authentication credentials to be used for different
  target urls.
  
  @param host The host name
  @param port The TCP port