title: CertPathValidatorException: Trust anchor for certification path not found when using Fiddler as proxy in Android
body: <p>Following my <a href="https://stackoverflow.com/questions/38329587/capturing-android-applicataion-traffic-using-fiddler">previous question</a> (it's still unanswered if you have an idea...), I tried to set the proxy explicitly in the Java code. When doing this, I finally see in Fiddler the request tunnel (<code>A SSLv3-compatible ClientHello handshake was found...</code>), but still not the request itself. However, instead of response 200 which I receive when not using proxy, the following error is thrown:</p>
  
  <pre><code>javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
  </code></pre>
  
  <p>In short, my primary goal is to automate a login process via emulating web browser behavior (in terms of headers &amp; post parameters). I managed to do it with a native Java application on PC, but the exact same code returns 400 in some request on Android (probably because the <code>HttpUrlConnection</code> class implementation is totally different in Android compared to Oracle SDK's), so I wanna capture the outgoing traffic and find the difference(s). I successfully got the requests sent from my PC and now struggling with Android.</p>
  
  <p>Android device browser requests are captured successfully, the problem occurs only with applications (specifically my app). I installed the Fiddler certificate on device and set the WiFi proxy as required.</p>
  
  <p>I also tried it on two devices, one of them is rooted, to no avail.</p>
  
  <p>Any help will be appreciated!</p>
  
  <p>Some code:</p>
  
  <pre><code>Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("192.168.0.120", 8888)); //My PC IP on local LAN
  conn = (HttpsURLConnection) url.openConnection(proxy);
  conn.setRequestMethod("GET");
  conn.setUseCaches(false);
  conn.setRequestProperty(...)               //Repeating thie line to add headers
  int responseCode = conn.getResponseCode(); //Exception is thrown in this line
  </code></pre>