I have tried implementing the unbound id in memory directory server for simulating an LDAP directory for testing purpose. The code works fine as a java application with an LDIF file as sample directory data. But when i use it in my android application code, the application aborts saying as "it is unable to find or load the class InMemoryDirectoryServerConfig" . Below are the key code snippet use to connect to the in Memory LDAP server.
InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig("dc=example,dc=com");
directoryServer = new InMemoryDirectoryServer(config);
directoryServer.importFromLDIF(true, getClass().getResource("example6.ldif").getPath());
directoryServer.startListening();
ldapConnection = directoryServer.getConnection();
SearchRequest searchRequest=new SearchRequest(techMbaseDn, SearchScope.SUB,Filter.createEqualityFilter("uid", name),"givenName","uid");
Kindly let me know whether its possible to simulate the directory server in an android app with ldif file and or its just not possible to use this code in an android app.
I've never tried it, but I'm not aware of any reason that the in-memory directory server wouldn't work on Android.
My guess is that you're trying to use the Minimal Edition of the LDAP SDK in your app. The Minimal Edition has a stripped-down set of classes that allows you to do a lot of LDAP communication but doesn't have a lot of optional stuff like the in-memory directory server. If you switch to the Standard Edition then you should have better luck.
If that's not the problem, then I'm not sure what the cause would be (unless it's that the LDAP SDK jar file isn't in your classpath, but I don't think that's the case since it looks like you have an earlier LDAPConnection variable defined). It would be good to see the exact error message you're getting to try to diagnose the problem.