Here's one of the configurations I use from the LDAP SDK unit tests:
final InMemoryDirectoryServerConfig cfg =
new InMemoryDirectoryServerConfig("dc=example,dc=com",
"o=example.com");
cfg.addAdditionalBindCredentials("cn=Directory Manager", "password");
cfg.addAdditionalBindCredentials("cn=Manager", "password");
cfg.setSchema(Schema.getDefaultStandardSchema());
cfg.setListenerExceptionHandler(
new StandardErrorListenerExceptionHandler());
final SSLUtil serverSSLUtil = new SSLUtil(
new KeyStoreKeyManager(keyStorePath, "password".toCharArray(),
"JKS", "server-cert"),
new TrustStoreTrustManager(trustStorePath));
final SSLUtil clientSSLUtil = new SSLUtil(new TrustAllTrustManager());
cfg.setListenerConfigs(InMemoryListenerConfig.createLDAPSConfig("LDAPS",
null, 0, serverSSLUtil.createSSLServerSocketFactory(),
clientSSLUtil.createSSLSocketFactory()));
final InMemoryDirectoryServer testDSWithSSL =
new InMemoryDirectoryServer(cfg);
testDSWithSSL.startListening();
Also, if you want to add support for StartTLS, you would add another listener config that looks like:
InMemoryListenerConfig.createLDAPConfig("LDAP with StartTLS", null, 0,
serverSSLUtil.createSSLSocketFactory())
Neil