title: javax.net.ssl.SSLPeerUnverifiedException: No peer certificate while I am working with google place api in android
body: <p>I am facing an javax.net.ssl.SSLPeerUnverifiedException: No peer certificate exception while working with google place api in android emulator.Below is my url:</p>
  
  <pre><code>https://maps.googleapis.com/maps/api/place/search/json?&amp;location=28.632808,77.218276&amp;radius=1000&amp;sensor=false&amp;key=AIzaSyC3y3fOMTqTkCjNNETQTCKustG7BRk_eVc
  </code></pre>
  
  <p>when i simply , paste above url in browser address bar , it simple gives Json string.So , i think there is no need of any certificate authentication.</p>
  
  <p>After doing so many googling and devoted 2-3 days, i've used SSLSocketFacory class of org.apache.http.conn.ssl.SSLSocketFactory package to avoid peer certificate error.</p>
  
  <p>below is my code :</p>
  
  <pre><code>public static HttpClient wrapClient(HttpClient base) {
          try {
              SSLContext ctx = SSLContext.getInstance("TLS");
              X509TrustManager tm = new X509TrustManager() {
  
                  public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException {
                  }
  
                  public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException {
                  }
  
                  public X509Certificate[] getAcceptedIssuers() {
                      return null;
                  }
              };
              X509HostnameVerifier verifier = new X509HostnameVerifier() {
  
                  public void verify(String string, SSLSocket ssls) throws IOException {
                  }
  
                  public void verify(String string, X509Certificate xc) throws SSLException {
                  }
  
                  public void verify(String string, String[] strings, String[] strings1) throws SSLException {
                  }
  
                  public boolean verify(String string, SSLSession ssls) {
                      return true;
                  }
              };
              ctx.init(null, new TrustManager[]{tm}, null);
              SSLSocketFactory ssf = new SSLSocketFactory(ctx);
              ssf.setHostnameVerifier(verifier);
              ClientConnectionManager ccm = base.getConnectionManager();
              SchemeRegistry sr = ccm.getSchemeRegistry();
              sr.register(new Scheme("https", ssf, 443));
              return new DefaultHttpClient(ccm, base.getParams());
          } catch (Exception ex) {
              ex.printStackTrace();
              return null;
          }
      }
  </code></pre>
  
  <p>I am using android api 16 , and when I used SSLSocketFactory(SSLSocketContext) constructor,eclipse gives compliation error , so i've search alot and download jar having 
  SSLSocketFactory(SSLSocketContext) ,which is "httpclient-4.1.1.jar" file.And i also set order of that jar in project build path , have set highest priority.Now I am getting following warning:</p>
  
  <pre><code>VFY:unable to resolve direct method 4253:Lorg/apache/http/conn/ssl/SSLSocketFactory.&lt;init&gt;
  </code></pre>
  
  <p>And following long trace of error caused by </p>
  
  <pre><code>java.lang.NoSuchMethodError : org.apace.http.conn.ssl.SSLSocketFactory.&lt;init&gt;
  </code></pre>
  
  <p>Please , help me I don't know ,where I am wrong.</p>