There actually is a constructor that matches the provided signature. That constructor is:
/**
* Creates a new LDAP connection using the specified socket factory. No
* actual network connection will be established.
*
* @param socketFactory The socket factory to use when establishing
* connections. If it is {@code null}, then a default
* socket factory will be used.
*/
public LDAPConnection(final SocketFactory socketFactory)
{
this(socketFactory, null);
}
SSLSocketFactory is a subclass of SocketFactory, so the code included in the example should work without any problems. I just confirmed this by creating a class with those three lines (creating an SSLUtil, creating an LDAPConnection, and establishing the connection) and it compiles without any warnings or errors using JDK 5, JDK 6, and JDK 7.
Also, to address another comment, the LDAP SDK does not recommend the creation of a TrustAllTrustManager. It does provide one example that uses the TrustAllTrustManager, but there is another example immediately below that demonstrates the process for using a trust store. In addition, the documentation for the TrustAllTrustStore class indicates that it is only recommended for testing purposes. Nevertheless, I have just committed a change to the SSLUtil example that makes this recommendation even clearer.