Code example for KeyManagementException

0
    private boolean init = false; 
     
    public void engineInit(KeyManager[] km, TrustManager[] tm, 
            SecureRandom sr) throws KeyManagementException { 
        if (sr == null) { 
            throw new KeyManagementException( 
                    "secureRandom is null"); 
        } 
        init = true; 
    } 
 
    public SSLSocketFactory engineGetSocketFactory() { 
        if (!init) { 
            throw new RuntimeException("Not initialiazed"); 
        }    
        return null; 
    } 
 
    public SSLServerSocketFactory engineGetServerSocketFactory() { 
        if (!init) { 
            throw new RuntimeException("Not initialiazed");