public void start() {
        for (port = 33389; port < 35000; port++) {
            try {
                startServer();
                return;
            } catch (final LDAPException e) {
                if (e.getResultCode() == ResultCode.LOCAL_ERROR) {
                    // ignore and try with the next port
                    System.out.println("Port already in use: " + port + ". Trying next one...");
                } else {
                    throw new RuntimeException(e);
                }
            } catch (final Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
Simulates a basic LDAP server.

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