geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/util/MailConnection.java [571:611]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    protected void getConnectedTLSSocket() throws MessagingException {
     	// it worked, now switch the socket into TLS mode
     	try {

            // we use the same target and port as the current connection.
            serverHost = socket.getInetAddress().getHostName();
            serverPort = socket.getPort();

            // the socket factory can be specified via a session property.  By default, we use
            // the native SSL factory.
            if(createSocketFromConfiguredFactoryInstance(true, true)) {
                debugOut("TLS socket factory configured as instance"); 
            } else if(createSocketFromFactory(true, true)) {
                debugOut("TLS socket factory configured as class"); 
            } else {
                debugOut("TLS socket factory from SSLContext"); 
                createSSLSocketFromSSLContext(true);
            }

            // if this is an instance of SSLSocket (very common), try setting the protocol to be
            // "TLSv1".  If this is some other class because of a factory override, we'll just have to
            // accept that things will work.
            if (socket instanceof SSLSocket) {
                String[] suites = ((SSLSocket)socket).getSupportedCipherSuites();
                ((SSLSocket)socket).setEnabledCipherSuites(suites);
                ((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1"} );
                ((SSLSocket)socket).setUseClientMode(true);
                debugOut("Initiating STARTTLS handshake");
                ((SSLSocket)socket).startHandshake();
            } else {
                throw new IOException("Socket is not an instance of SSLSocket, maybe wrong configured ssl factory?");
            }

            getConnectionStreams(); 
            debugOut("TLS connection established"); 
     	}
        catch (Exception e) {
            debugOut("Failure attempting to convert connection to TLS", e);
     	    throw new MessagingException("Unable to convert connection to SSL", e);
     	}
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-javamail_1.5/geronimo-javamail_1.5_provider/src/main/java/org/apache/geronimo/javamail/util/MailConnection.java [571:611]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    protected void getConnectedTLSSocket() throws MessagingException {
     	// it worked, now switch the socket into TLS mode
     	try {

            // we use the same target and port as the current connection.
            serverHost = socket.getInetAddress().getHostName();
            serverPort = socket.getPort();

            // the socket factory can be specified via a session property.  By default, we use
            // the native SSL factory.
            if(createSocketFromConfiguredFactoryInstance(true, true)) {
                debugOut("TLS socket factory configured as instance"); 
            } else if(createSocketFromFactory(true, true)) {
                debugOut("TLS socket factory configured as class"); 
            } else {
                debugOut("TLS socket factory from SSLContext"); 
                createSSLSocketFromSSLContext(true);
            }

            // if this is an instance of SSLSocket (very common), try setting the protocol to be
            // "TLSv1".  If this is some other class because of a factory override, we'll just have to
            // accept that things will work.
            if (socket instanceof SSLSocket) {
                String[] suites = ((SSLSocket)socket).getSupportedCipherSuites();
                ((SSLSocket)socket).setEnabledCipherSuites(suites);
                ((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1"} );
                ((SSLSocket)socket).setUseClientMode(true);
                debugOut("Initiating STARTTLS handshake");
                ((SSLSocket)socket).startHandshake();
            } else {
                throw new IOException("Socket is not an instance of SSLSocket, maybe wrong configured ssl factory?");
            }

            getConnectionStreams(); 
            debugOut("TLS connection established"); 
     	}
        catch (Exception e) {
            debugOut("Failure attempting to convert connection to TLS", e);
     	    throw new MessagingException("Unable to convert connection to SSL", e);
     	}
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



