You create an LDAPListener to handle incoming client
connections. The LDAPListener takes a connection handler
that deals with the connections, in this case connections back to the
directory servers handling client requests.
final LDAPListenerOptions options = new LDAPListenerOptions().setBacklog(4096);
LDAPListener listener = null;
try {
listener = new LDAPListener(localAddress, localPort, connectionHandler,
options);
System.out.println("Press any key to stop the server...");
System.in.read();
} catch (final IOException e) {
System.out.println("Error listening on " + localAddress + ":" + localPort);
e.printStackTrace();
} finally {
if (listener != null) {
listener.close();
}
}
You get a ServerConnectionFactory to handle requests
coming from clients. The ServerConnectionFactory takes a
request handler that deals with the incoming client requests. The request
handler implements handlers for all supported operations. The Proxy example
implements a ProxyBackend to handle requests. The
ProxyBackend sends the requests on to the backend
directory servers and routes the results returned back to client
applications.
final ProxyBackend backend = new ProxyBackend(factory, bindFactory);
final ServerConnectionFactory<LDAPClientContext, Integer> connectionHandler =
Connections.newServerConnectionFactory(backend);
See the Proxy example code for details about the
ProxyBackend implementation.

