final ServiceDaemon orange = server();
final Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
final ConfigurationFactory config = new ConfigurationFactory();
final JndiProvider jndiProvider = new JndiProvider("orange");
final Properties p = jndiProvider.getProperties();
p.setProperty(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName());
p.setProperty(Context.PROVIDER_URL, "ejbd://localhost:" + orange.getPort());
final JndiContextInfo contextInfo = config.configureService(jndiProvider, JndiContextInfo.class);
assembler.createExternalContext(contextInfo);
{// Create the "Orange" bean
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(OrangeBean.class));
assembler.createApplication(config.configureApplication(ejbJar));
// Lets look it up the normal way to be sure it can work
final InitialContext initialContext = new InitialContext(jndiProvider.getProperties());
final OrangeRemote orangeBeanRemote = (OrangeRemote) initialContext.lookup("OrangeBeanRemote");
assertNotNull(orangeBeanRemote);
}
{// Create the "Blue" bean