title: Authentication fail with okhttp + ssl + basic auth
body: <p>I'm using okhttp3 to request some web service through SSL + basic auth using the following client builder:</p>
  
  <pre><code>client = new OkHttpClient.Builder()
      .sslSocketFactory(sslContext.getSocketFactory())
      .hostnameVerifier(new HostnameVerifier() {
          @Override
          public boolean verify(String hostname, SSLSession session) {
              return true;
          }
      })
      .authenticator(new Authenticator() {
          @Override
          public Request authenticate(Route route, Response response) throws IOException {
              String credential = Credentials.basic("myuser", "mypassword");
              return response.request().newBuilder()
                      .header("Authorization", credential)
                      .build();
          }
      })
      .build()
  </code></pre>
  
  <p>then I run the request with</p>
  
  <pre><code>Request.Builder requestBuilder = new Request.Builder();
  requestBuilder.url(url);
  Request request = requestBuilder.build();
  
  Call call = client.newCall(request);
  Response response = call.execute();
  </code></pre>
  
  <p>and I get a 403 (access denied).</p>
  
  <p>I tried using cURL and I get authenticated correctly.</p>
  
  <p>I set a breakpoint in the <code>authenticate</code>  function, and it seems that it is not even called.</p>
  
  <p>If I set the header directly in <code>requestBuilder</code>, i.e.</p>
  
  <pre><code>Request.Builder requestBuilder = new Request.Builder();
  requestBuilder.url(url);
  String credential = Credentials.basic("myuser", "mypassword");
  requestBuilder.header("Authorization", credential).build();
  Request request = requestBuilder.build();
  
  Call call = client.newCall(request);
  Response response = call.execute();
  </code></pre>
  
  <p>it works.</p>
  
  <p>Any suggestion?</p>