class RpcStreamConnection extends RpcConnection {

    void initSSL() throws ConnectionException {
        // Start SSL handshake
        if (nonNull(socket)) {
            try {
                // The SSLSocket.getSession() method will initiate the initial
                // handshake if necessary. Thus, the SSLSocket.startHandshake()
                // call is not necessary.
                SSLSession sslSession = ((SSLSocket) socket).getSession();

                // p4ic4idea: isValid isn't what this thinks it is.  It's checking whether the
                // session is resumeable or not, which isn't what we care about.
                // Even if it is valid, it should be throwing the more precise
                // exception SslException
                /*
                 * If an error occurs during the initial handshake, this method
                 * returns an invalid session object which reports an invalid
                 * cipher suite of "SSL_NULL_WITH_NULL_NULL".
                 */
                //throwConnectionExceptionIfConditionFails(sslSession.isValid(),
                //        "Error occurred during the SSL handshake: invalid SSL session");

                // Get the certificates
                Certificate[] serverCerts = sslSession.getPeerCertificates();
                // p4ic4idea: use a more precise exception
                //throwConnectionExceptionIfConditionFails(
                //        nonNull(serverCerts) && (serverCerts.length != 0)
                //                && nonNull(serverCerts[0]),
                //        "Error occurred during the SSL handshake: no certificate retrieved from SSL session");
                if (isNull(serverCerts) || (serverCerts.length <= 0) || isNull(serverCerts[0])) {
                    throw new SslException(
                            "Error occurred during the SSL handshake: no certificate retrieved from SSL session");
                }
                // Check that the certificate is currently valid. Check the
                // current date and time are within the validity period given
                // in the certificate.
                ((X509Certificate) serverCerts[0]).checkValidity();

                // Get the public key from the first certificate
                PublicKey serverPubKey = serverCerts[0].getPublicKey();
                // p4ic4idea: use a more precise exception
                //throwConnectionExceptionIfConditionFails(nonNull(serverPubKey),
                //        "Error occurred during the SSL handshake: no public key retrieved from server certificate");
                if (isNull(serverPubKey)) {
                    throw new SslException(
                            "Error occurred during the SSL handshake: no public key retrieved from server certificate");
                }
                // Generate the fingerprint
                fingerprint = ClientTrust.generateFingerprint(serverPubKey);
            } catch (CertificateExpiredException e) {
                // p4ic4idea: use a more precise exception
                throw new SslException(
                        "Error occurred during the SSL handshake: certificate expired",
			e);
            } catch (CertificateNotYetValidException e) {
                // p4ic4idea: use a more precise exception
                throw new SslException(
                        "Error occurred during the SSL handshake: certificate not yet valid",
			e);
            } catch (NoSuchAlgorithmException e) {
                // p4ic4idea: use a more precise exception
                throw new SslHandshakeException(
                        "Error occurred while generating the fingerprint for the Perforce SSL connection",
                        e);
            } catch (SSLPeerUnverifiedException e) {
                // p4ic4idea: use a more precise exception
                throw new SslHandshakeException("Error occurred while verifying the SSL peer.", e);
            }
        }
    }

    public  RpcStreamConnection(String serverHost, int serverPort, Properties props,
                               ServerStats stats, P4Charset p4Charset, boolean secure);
    private  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, P4Charset p4Charset, Socket socket, boolean secure);
    private  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, P4Charset p4Charset, Socket socket, RpcSocketPool pool, boolean secure);
    public  RpcStreamConnection(String serverHost, int serverPort, Properties props,
            ServerStats stats, P4Charset p4Charset, Socket socket, RpcSocketPool pool, boolean secure,
            String rsh);

}