Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"dazzle.jndi.testing.spi.DazzleContextFactory");
env.put(Context.URL_PKG_PREFIXES, "org.apache.harmony.jndi.tests.javax.naming.spi.mock");
Reference r = new Reference(null);
MockRefAddr mockAddr = new MockRefAddr("URL", "dire://www.apache.org/");
r.add(mockAddr);
mockAddr = new MockRefAddr(null, "dire://www.apache.org/");
r.add(mockAddr);
Attributes a = new BasicAttributes();
Object obj = DirectoryManager.getObjectInstance(r, new CompositeName(
"compositename"), new MockContext(new Hashtable<String, String>()), env, a);