There is a static way of providing SocketFactory to InitialLdapContext:
env.put("java.naming.ldap.factory.socket", MySocketFactory.class.getName());
new InitialLdapContext(env, null);
But is there some way to provide the instance itself instead of its class name? My socket factory is parameterized with the input stream of trusted certificate and there can be configured many instances of InitialLdapContext with different trusted certificates. BTW this will run in OSGi environment.
Thanks in advance.