I'm using following method to implement SSL Certification in both java and android app but in many post I saw its not secure and only suitable for testing purposes. so can someone give me a example about implement SSL Certification for a production environment.?
TrustStrategy easyStrategy = new TrustStrategy() {
                @Override
                public boolean isTrusted(X509Certificate[] chain, String authType)
                        throws CertificateException {
                    // eh, why not?
                    return true;
                }
            };
            SchemeRegistry schemeRegistry = new SchemeRegistry();
            SSLContext sslcontext = SSLContext.getInstance("TLS");
            sslcontext.init(null, null, null);
            SSLSocketFactory ssf = new SSLSocketFactory(easyStrategy);
            ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
UPDATE : I found out the server I'm trying to access is issuing a self signed certificate when I connect to it through a web browser. here is the openssl output I got:
verify error:num=18:self signed certificate
and it also gives a lengthy code that it says server certificate. can I use it to create my own certificate and use it inside my applications.?
 
    