title: HtmlUnit - Connection through proxy : URLConnection OK, WebClient KO
body: <p>I cannot access http pages through a proxy with WebClient.</p>
  
  <p>When I use an URLConnection there is no problem :</p>
  
  <pre><code>Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("hostname", 8080));
  
  URLConnection urlConnection = new URL("https://www.google.com/").openConnection(proxy);
  
  BufferedReader bufferedReader = null;
  
  try {
  
      bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
  
      String line;
  
      while ((line = bufferedReader.readLine()) != null) {
  
          System.out.println(line);
      }
  
  } finally {
  
      if (bufferedReader != null) {
  
          bufferedReader.close();
      }
  }
  </code></pre>
  
  <p>But when I try with WebClient, I have an error :</p>
  
  <pre><code>WebClient webClient = new WebClient(BrowserVersion.CHROME, "hostname", 8080);
  
  webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
  webClient.getOptions().setThrowExceptionOnScriptError(false);
  
  HtmlPage htmlPage = webClient.getPage("https://www.google.com/");
  
  System.out.println(htmlPage.asText());
  </code></pre>
  
  <p>The error is "407 Proxy Authentication Required. The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied."</p>
  
  <p>I don't understand why with URLConnection there is no authentication problem.</p>
  
  <p>Thank you for your help !</p>