final MemoryBackend backend;
if (getLdifFile() == null) {
backend = new MemoryBackend();
} else {
final InputStream inputStream = new FileInputStream(getLdifFile());
final LDIFEntryReader reader = new LDIFEntryReader(inputStream);
backend = new MemoryBackend(reader);
}
final ServerConnectionFactory<LDAPClientContext, Integer> connectionHandler = Connections.newServerConnectionFactory(backend);
final LDAPListenerOptions options = new LDAPListenerOptions().setBacklog(4096);
listener = new LDAPListener("localhost", getServerPort(), connectionHandler, options);