public static SSLContext createSSLContext(String trustedCert,String clientKey,String clientCert){
  try {
    SSLContext ctx=SSLContext.getInstance("TLS");
    ctx.init(CertificateUtil.getKeyManagers("client",clientKey,clientCert),CertificateUtil.getTrustManagers("server",trustedCert),null);
    return ctx;
  }
 catch (  NoSuchAlgorithmException|KeyManagementException e) {
    throw new RuntimeException("Failed to create SSLContext",e);
  }
}

public static SSLContext createSSLContext ( String trustedCert , String clientKey , String clientCert ) { try { SSLContext ctx = SSLContext . getInstance ( "TLS" ) ; ctx . init ( CertificateUtil . getKeyManagers ( "client" , clientKey , clientCert ) , CertificateUtil . getTrustManagers ( "server" , trustedCert ) , null ) ; return ctx ; } catch ( NoSuchAlgorithmException | KeyManagementException e ) { throw new RuntimeException ( "Failed to create SSLContext" , e ) ; } }
create a sslcontext for a given trusted certificate and client key and certificate
