code: private SSLEngine getSSLEngine() throws KeyStoreException, 
                      CertificateException, 
                      IOException, 
                      UnrecoverableKeyException, 
                      KeyManagementException {
  
          // Open the KeyStore Stream
          final StreamManager streamManager = new StreamManager();
  
          SSLContext ctx;
          KeyManagerFactory kmf;
  
          try {
              final InputStream ksStream = getClass().getClassLoader().getResourceAsStream(KEYSTORE_NAME);
              streamManager.handle(ksStream);
              ctx = SSLContext.getInstance("SSLv3");
  
              kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
  
              final KeyStore ks = KeyStore.getInstance("JKS");
              char[] passphrase = KEYSTORE_PWD.toCharArray();
              ks.load(ksStream, passphrase);
  
              kmf.init(ks, passphrase);
              ctx.init(kmf.getKeyManagers(), null, new java.security.SecureRandom());
          } catch (NoSuchAlgorithmException e) {
              throw new SSLException("Unable to initialize SSLSocketFactory" + e.getMessage(), e);
          } finally {
              streamManager.closeAll();
          }
  
          return ctx.createSSLEngine();
      }
docs: Creates, configures and returns the SSL engine.
  
  
  
  
  
  
  
  @return the SSL Engine * @throws KeyStoreException
  on keystore errorss * @throws CertificateException
  on certificate errors * @throws IOException
  on I/O errors * @throws UnrecoverableKeyException
  if key is unrecoverable * @throws KeyManagementException
  key management error