title: Verify hostname on SSL Certificate - Android
body: <p>I am using <code>HttpsURLConnection</code> to connect to a server. I implemented the verify method of <code>HostnameVerifie</code>r interface to verify the hostname.</p>
  
  <p><strong>This is my code.</strong></p>
  
  <pre><code>HostnameVerifier hostnameVerifier = new HostnameVerifier() {
      @Override
      public boolean verify(String hostname, SSLSession session) {
          boolean allow = HttpsURLConnection.getDefaultHostnameVerifier().verify(hostname,session);
          return allow;
      }
  };
  </code></pre>
  
  <p>Is this enough to verify hostnames? As I do not have enough knowledge on <strong>SSL</strong>, <strong>CA</strong> etc I am unable to decide.</p>
  
  <p>If this is not sufficient, How do I verify hostnames on SSL Certificates in Android?</p>
  
  <p><strong>How do I test this current piece of code? I have never used a hacking tool.</strong></p>