Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.ldap
Class LdapSSLSocketFactoryDelegate

java.lang.Object
  extended by net.java.sip.communicator.impl.ldap.LdapSSLSocketFactoryDelegate

public class LdapSSLSocketFactoryDelegate
extends Object

Utility class to delegate the creation of sockets to LDAP servers to our CertificateService.

Note that the documentation says to extend SocketFactory, but the LDAP directory context tries to create an unconnected socket without a hostname first by calling createSocket. It would be impossible to validate the hostname against the certificate, which leads to an insecure communication. It only calls createSocket(String, int) when createSocket is not found

Author:
Ingo Bauersachs

Constructor Summary
LdapSSLSocketFactoryDelegate()
           
 
Method Summary
 Socket createSocket(String host, int port)
          Creates a socket for the specified destination host and port.
static Object getDefault()
          Get default SSL socket factory delegate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapSSLSocketFactoryDelegate

public LdapSSLSocketFactoryDelegate()
Method Detail

getDefault

public static Object getDefault()
Get default SSL socket factory delegate.

Returns:
default SSL socket factory delegate.

createSocket

public Socket createSocket(String host,
                           int port)
                    throws IOException,
                           UnknownHostException
Creates a socket for the specified destination host and port.

Parameters:
host - The hostname that the socket connects to.
port - The port that the socket connects to.
Returns:
The created socket.
Throws:
IOException
UnknownHostException - When the hostname cannot be resolved to an IP address.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.