code: public void init() throws SSLException {
          if (sslEngine != null) {
              // We already have a SSL engine created, no need to create a new one
              return;
          }
  
          InetSocketAddress peer = (InetSocketAddress) session
                  .getAttribute(SslFilter.PEER_ADDRESS);
          
          // Create the SSL engine here
          if (peer == null) {
              sslEngine = sslContext.createSSLEngine();
          } else {
              sslEngine = sslContext.createSSLEngine(peer.getHostName(), peer.getPort());
          }
          
          // Initialize the engine in client mode if necessary
          sslEngine.setUseClientMode(parent.isUseClientMode());
  
          // Initialize the different SslEngine modes
          if (parent.isWantClientAuth()) {
              sslEngine.setWantClientAuth(true);
          }
  
          if (parent.isNeedClientAuth()) {
              sslEngine.setNeedClientAuth(true);
          }
  
          if (parent.getEnabledCipherSuites() != null) {
              sslEngine.setEnabledCipherSuites(parent.getEnabledCipherSuites());
          }
  
          if (parent.getEnabledProtocols() != null) {
              sslEngine.setEnabledProtocols(parent.getEnabledProtocols());
          }
  
          // TODO : we may not need to call this method...
          sslEngine.beginHandshake();
          
          
          handshakeStatus = sslEngine.getHandshakeStatus();
  
          handshakeComplete = false;
          initialHandshakeComplete = false;
          writingEncryptedData = false;
      }
docs: Initialize the SSL handshake.
  
  @throws SSLException