title: OkHttp request via Proxy with Authentcation fails
body: <p>Similar question was at GitHub: <a href="https://github.com/square/okhttp/issues/2900" rel="nofollow noreferrer">https://github.com/square/okhttp/issues/2900</a></p>
  
  <p>I'm trying to make a request using code:</p>
  
  <pre><code>final Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyhost", 8001));
  final Response response = new OkHttpClient.Builder()
          .proxy(proxy)
          .proxyAuthenticator(new Authenticator() {
              @Override
              public Request authenticate(Route route, Response response) throws IOException {
                  String credential = Credentials.basic("proxyuser", "proxypass");
                  return response.request().newBuilder()
                          .header("Proxy-Authorization", credential)
                          .build();                        
              }
          })
          .build()
          .newCall(new Request.Builder()
                  .get()
                  .url("https://www.google.com/")
                  .build())
          .execute();
  </code></pre>
  
  <p>But I get the error: <code>407 Proxy Authentication Required</code></p>
  
  <p>Btw, when I set up proxy on my PC, open Chrome and go to google, a window pops up where I should enter login and password. And if I click cancel - the same page appers with text </p>
  
  <blockquote>
    <p>407 Proxy Authentication Required. Access to requested resource
    disallowed by administrator or you need valid username/password to use
    this resource</p>
  </blockquote>
  
  <p>So my question is how to use proxy with OkHttp? It would be useful to know other ways or libraries to work with the proxy</p>