Source:
<code>protected LDAPConnectionFactory createLdapConnectionFactory(String url, Boolean startTls) throws LdapException { boolean useSsl = url.startsWith("ldaps"); boolean useTls = !url.startsWith("ldaps") && startTls; Options lo = Options.defaultOptions(); try { if (useSsl || useTls) { LOGGER.trace("Setting up secure LDAP connection."); initializeSslContext(); lo.set(LDAPConnectionFactory.SSL_CONTEXT, getSslContext()); } else { LOGGER.trace("Setting up insecure LDAP connection."); } } catch (GeneralSecurityException e) { LOGGER.info("Error encountered while configuring SSL. Secure connection will fail.", e); } lo.set(LDAPConnectionFactory.HEARTBEAT_TIMEOUT, new Duration(30L, TimeUnit.SECONDS)); lo.set(LDAPConnectionFactory.HEARTBEAT_INTERVAL, new Duration(60L, TimeUnit.SECONDS)); lo.set(LDAPConnectionFactory.CONNECT_TIMEOUT, new Duration(30L, TimeUnit.SECONDS)); lo.set(LDAPConnectionFactory.SSL_USE_STARTTLS, useTls); lo.set( LDAPConnectionFactory.SSL_ENABLED_CIPHER_SUITES, Arrays.asList(System.getProperty("https.cipherSuites", "").split(","))); lo.set( LDAPConnectionFactory.SSL_ENABLED_PROTOCOLS, Arrays.asList(System.getProperty("https.protocols", "").split(","))); lo.set( LDAPConnectionFactory.TRANSPORT_PROVIDER_CLASS_LOADER, SslLdapLoginModule.class.getClassLoader()); <START> String host = url.substring(url.indexOf("://") + 3, url.lastIndexOf(':')); <END> Integer port = useSsl ? 636 : 389; try { port = Integer.valueOf(url.substring(url.lastIndexOf(':') + 1)); } catch (NumberFormatException ignore) { } auditRemoteConnection(host); return new LDAPConnectionFactory(host, port, lo); }</code><technical_language><LINK_0> for this parsing yourself</technical_language>

Target:
protected LDAPConnectionFactory createLdapConnectionFactory(String url, Boolean startTls) { boolean useSsl = url.startsWith("ldaps"); boolean useTls = !url.startsWith("ldaps") && startTls; Options lo = Options.defaultOptions(); try { if (useSsl || useTls) { LOGGER.trace("Setting up secure LDAP connection."); initializeSslContext(); lo.set(LDAPConnectionFactory.SSL_CONTEXT, getSslContext()); } else { LOGGER.trace("Setting up insecure LDAP connection."); } } catch (GeneralSecurityException e) { LOGGER.info("Error encountered while configuring SSL. Secure connection will fail.", e); } lo.set(LDAPConnectionFactory.HEARTBEAT_TIMEOUT, new Duration(30L, TimeUnit.SECONDS)); lo.set(LDAPConnectionFactory.HEARTBEAT_INTERVAL, new Duration(60L, TimeUnit.SECONDS)); lo.set(LDAPConnectionFactory.CONNECT_TIMEOUT, new Duration(30L, TimeUnit.SECONDS)); lo.set(LDAPConnectionFactory.SSL_USE_STARTTLS, useTls); String cipherSuites = System.getProperty(SecurityConstants.HTTPS_CIPHER_SUITES); if (cipherSuites != null) { lo.set( LDAPConnectionFactory.SSL_ENABLED_CIPHER_SUITES, Arrays.asList(cipherSuites.split(","))); } String protocols = System.getProperty(HTTPS_PROTOCOLS); if (protocols != null) { lo.set(LDAPConnectionFactory.SSL_ENABLED_PROTOCOLS, Arrays.asList(protocols.split(","))); } lo.set( LDAPConnectionFactory.TRANSPORT_PROVIDER_CLASS_LOADER, SslLdapLoginModule.class.getClassLoader()); LDAPUrl parsedUrl = LDAPUrl.valueOf(url); String host = parsedUrl.getHost(); Integer port = parsedUrl.getPort(); auditRemoteConnection(host); return new LDAPConnectionFactory(host, port, lo); }