private static LDAPConnection getConnection(Map<LdapConfigBean, LDAPConnectionPool> map,
            SSLSocketFactory socketFactory, LdapConfigBean config) throws LDAPException {
        if (!map.containsKey(config)) {
            LDAPConnection template;
            if (socketFactory != null) {
                // LDAPS (with SSL)
                template = new LDAPConnection(socketFactory);
                template.connect(config.getHost(), config.getPort());
            } else {
                // LDAP
                template = new LDAPConnection(config.getHost(), config.getPort());
            }
            map.put(config, new LDAPConnectionPool(template, MAX_CONNECTIONS_PER_POOL));
        }
        return map.get(config).getConnection();
    }
@author Marc Savy {@literal <msavy@redhat.com>}
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/LDAPConnectionFactory.java