I hope you are using this method
public void connect() throws Exception {
HttpPost post = new HttpPost(new URI(""));
post.setEntity(new StringEntity(""));
trustAll();
HttpClient client = new DefaultHttpClient();
HttpResponse result = client.execute(post);
}
Add this code before the HttpsURLConnection and it will be done.
private void trustAll() {
try {
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier(){
public boolean verify(String hostname, SSLSession session) {
return true;
}});
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, new X509TrustManager[]{new X509TrustManager(){
public void checkClientTrusted(X509Certificate[] chain,
String authType) throws CertificateException {}
public void checkServerTrusted(X509Certificate[] chain,
String authType) throws CertificateException {}
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}}}, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(
context.getSocketFactory());
} catch (Exception e) {
Log.e("TAG",e);
}
}
this method worked for me to accept the certificates and also try increasing the session time out.