code: private void startTLS() throws NotInitializedException {
      try {
        this.shaking = true;
        SSLSocketFactory cltFct = parentConnection.getSSLFactory();
        SSLSocket sslSocket = (SSLSocket) cltFct.createSocket(this.plainSocket, null, this.plainSocket.getPort(), false);
  
        sslSocket.setEnableSessionCreation(parentConnection.getSSLConfig().getBooleanValue(
            SDEnableSessionCreation.ordinal(), true));
        // only clients start shake
        if (parentConnection.getSSLConfig().getStringValue(CipherSuites.ordinal(), null) != null) {
          sslSocket.setEnabledCipherSuites(parentConnection.getSSLConfig().getStringValue(CipherSuites.ordinal(), null)
              .split(","));
        }
  
        this.inputStream = sslSocket.getInputStream();
        this.outputStream = sslSocket.getOutputStream();
        this.plainSocket = sslSocket;
  
        if (this.client) {
          sslSocket.setUseClientMode(true);
          // TODO: catch this to check for failure
          sslSocket.addHandshakeCompletedListener(this.handshakeListener);
          sslSocket.startHandshake();
        } else {
          sslSocket.addHandshakeCompletedListener(this.handshakeListener);
          sslSocket.setUseClientMode(false);
        }
  
      } catch (Exception e) {
        // TODO: ensure close?
        throw new NotInitializedException(e);
      }
    }
docs: @throws NotInitializedException