// start the LDAP server var ldapServer = new BaseLdapServer().start();
// Set up the environment for creating the initial context
Hashtable<Object, Object> env = new Hashtable<>(11);
env.put(Context.PROVIDER_URL, URIBuilder.newBuilder()
.scheme("ldap")
.loopback()
.port(ldapServer.getPort())
.build().toString());
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
// Wait up to 10 seconds for a response from the LDAP server
env.put("com.sun.jndi.ldap.read.timeout", "10000");
// Don't wait until the first search reply is received
env.put("com.sun.jndi.ldap.search.waitForReply", "false");
// Send the LDAP search request without first authenticating (no bind)
env.put("java.naming.ldap.version", "3");
try (ldapServer) {
// Create initial context
System.out.println("Client: connecting to the server");
DirContext ctx = new InitialDirContext(env);
// Server will never reply: either we waited in the call above until // the timeout (fail) or we did not wait and reached here (pass).
passed = true;
System.out.println("Client: did not wait until first reply");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.