title: Android HttpURLConnection- easiest way to trust all hosts?
body: <p>I'm trying to hit an https site through an Android client:</p>
  
  <pre><code>            URL url = new URL(myurl);
              Log.d("Connection", myurl);
              HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
              conn.setReadTimeout(10000 /* milliseconds */);
              conn.setConnectTimeout(15000 /* milliseconds */);
              conn.addRequestProperty("Content-Type", "application/json");
              conn.setRequestMethod("POST");
              conn.setDoInput(true);
              // Starts the query
              Log.d("Connection", "Connecting...");
              conn.connect();
  </code></pre>
  
  <p>The <code>connect</code> call is throwing an exception:</p>
  
  <pre><code>javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
  </code></pre>
  
  <p>EDIT: I'm told the site is using a self-signed certificate, and since this is only a prototype I just need to trust all hosts so it will work.  Can someone point me toward a simple example of doing this?  The code I've seen online gets quite complicated, I just want to do a hacky bypass of any verification.</p>