protected void startServer() throws LDAPException, LDIFException {
        val dsConfig = new InMemoryDirectoryServerConfig(BASE_DN);
        dsConfig.setSchema(null);
        dsConfig.setEnforceAttributeSyntaxCompliance(false);
        dsConfig.setEnforceSingleStructuralObjectClass(false);
        dsConfig.setListenerConfigs(new InMemoryListenerConfig("myListener", null, port, null, null, null));
        dsConfig.addAdditionalBindCredentials(CN + "=" + GOOD_USERNAME + "," + BASE_PEOPLE_DN, PASSWORD);
        dsConfig.addAdditionalBindCredentials(CN + "=" + GOOD_USERNAME2 + "," + BASE_PEOPLE_DN, PASSWORD);
        this.ds = new InMemoryDirectoryServer(dsConfig);
        this.ds.add("dn: " + BASE_DN, "objectClass: organizationalUnit", "objectClass: top");
        this.ds.add("dn: " + BASE_PEOPLE_DN, "objectClass: organizationalUnit");
        this.ds.add("dn: " + CN + "=" + GOOD_USERNAME + "," + BASE_PEOPLE_DN, CN + ": " + GOOD_USERNAME, SN + ": "
            + FIRSTNAME_VALUE, "objectClass: person");
        this.ds.add("dn: " + CN + "=" + GOOD_USERNAME2 + "," + BASE_PEOPLE_DN, ROLE + ": " + ROLE1, ROLE + ": " + ROLE2,
            "objectClass: person");

        //Debug.setEnabled(true);

        this.ds.startListening();
    }
Simulates a basic LDAP server.

@author Jerome Leleu
@since 1.8.0
pac4j-ldap/src/test/java/org/pac4j/ldap/test/tools/LdapServer.java