user = principal.getName();
password = principal.getPassword();
}
Authenticator authenticator = new TestAuthenticator(principal);
ORB orb = createORB(authenticator);
CallbackService serviceImpl = new CallbackServiceImpl();
Proxy proxy = orb.exportObject(serviceImpl);
orb.getRegistry().bind("service", proxy);
ORB client = getClientORB();
Registry registry = getRegistry(principal);
CallbackService service = (CallbackService) registry.lookup("service");
LoggingCallback callback = new LoggingCallback();
Callback callbackProxy = (Callback) client.exportObjectTo(
callback, getServerURI(), user, password);
service.addCallback(callbackProxy);
for (int i = 0; i < count; ++i) {
service.invoke(new Integer(i));
}
Integer[] objects = (Integer[]) callback.getObjects().toArray(
new Integer[0]);
assertEquals(count, objects.length);
for (int i = 0; i < count; ++i) {
assertEquals(i, objects[i].intValue());
}
client.unexportObject(callback);
try {
service.invoke(new Integer(0));
} catch (RemoteInvocationException expected) {
// expected behaviour
assertTrue(expected.getTargetException()