title: How to proxy requests to api.twitter.com including SSL certificates?
body: <p>I'm using Twitter's new <a href="https://dev.twitter.com/twitter-kit/android">Fabric SDK</a> for Android. I've set up <a href="http://www.charlesproxy.com/">Charles</a> as a proxy on my Mac so I can analyse the JSON payload in the API responses.</p>
  
  <p>SSL proxying in Charles is enabled and access granted for my test device.</p>
  
  <p>However, Charles shows me the following error for any request to Twitter:</p>
  
  <blockquote>
    <p><strong>URL</strong>   <a href="https://api.twitter.com">https://api.twitter.com</a></p>
    
    <p><strong>Status</strong>    Failed</p>
    
    <p><strong>Failure</strong>   SSLHandshake: Received fatal alert: certificate_unknown</p>
  </blockquote>
  
  <p>Logcat shows me:</p>
  
  <pre><code>retrofit.RetrofitError: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.   
  
  Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
      at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:306)
      at com.squareup.okhttp.Connection.upgradeToTls(Connection.java:241)
      at com.squareup.okhttp.Connection.connect(Connection.java:158)
      at com.squareup.okhttp.Connection.connectAndSetOwner(Connection.java:174)
      at com.squareup.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:120)
  
  Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
      at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:318)
      at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:209)
      at io.fabric.sdk.android.services.network.PinningTrustManager.checkSystemTrust(PinningTrustManager.java:117)
      at io.fabric.sdk.android.services.network.PinningTrustManager.checkServerTrusted(PinningTrustManager.java:160)
  </code></pre>
  
  <p>It looks to me like I need to trust some certificates...
  Any ideas?</p>