title: Android Retrofit update HTTP client configuration
body: <p>We have a case where we may have to update the public keys when using Certificate Pinning with OKHttp client and Retrofit. My question is how I would update the certificate pinner of the http client after retrofit has been initialized (like, when a new public key has been received)?</p>
  
  <p>Do I update the CertificatePinner in the http client and then create a new instance of retrofit? Or is there an easier way?</p>
  
  <p>Any suggestions appreciated.</p>
  
  <pre><code>OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
  clientBuilder.certificatePinner(NetworkUtils.getCertificatePinner()) ;
  OKHTTPClient client = clientBuilder.build();
  Retrofit myRetrofit = new Retrofit.Builder()
                  .baseUrl(url)
                  .client(client)
                  .build();
  // Now I need to update the certificate pinner, like this?
  client.certificatePinner(NetworkUtils.getCertificatePinner());
  myRetrofit = new Retrofit.Builder()
                  .baseUrl(url)
                  .client(client)
                  .build();
  </code></pre>