title: javax.net.ssl.SSLException: hostname in certificate didn't match in Android
body: <p>I am updating the web service URL of the android application, we are using <code>https</code> protocol. I see that my current https URL is working but now we are migrating to new domain then it is creating problem.</p>
  
  <p>I have checked many threads on stackoverflow like <a href="https://stackoverflow.com/questions/25356739/javax-net-ssl-sslexception-hostname-in-certificate-didnt-match-android">javax.net.ssl.SSLException: hostname in certificate didn&#39;t match android</a> but didn't find any good answer mostly are answering bypass this security or allow all.</p>
  
  <blockquote>
    <p>javax.net.ssl.SSLException: hostname in certificate didn't match: </p>
  </blockquote>
  
  <pre><code>//HttpGet getMethod = new HttpGet(String.format(httpURL));
  HttpGet getMethod = new HttpGet(httpURL);
  DefaultHttpClient client = new DefaultHttpClient();
  ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler();
  HttpParams params = client.getParams();
  params.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 60000);
  params.setParameter(CoreConnectionPNames.SO_TIMEOUT, 60000);
  client.setParams(params);
  responseBody = client.execute(getMethod, responseHandler);
  responseBody = responseBody.trim();
  </code></pre>
  
  <p>Thanks in advance.</p>