}
public void testTimeout() throws Exception {
// rpc infrastructure
Dispatcher timeoutdispatcher = new TimeoutDispatcher(PORT_NUMBER);
// business objects
serverAccount = new AccountImpl(accountId);
serverAccount.deposit(initialBalance);
// register serverside object
timeoutdispatcher.register(accountId, serverAccount);
// run dispatcher
timeoutdispatcher.start();
// client side: create remote object factory and remote object
rof = new RemoteObjectFactory(localhost, PORT_NUMBER);
accountProxy = (Account)rof.createRemoteObject(Account.class, accountId);
assertNotNull(accountProxy);
try {
// do some remote ops
accountProxy.balance();
fail("SimpleRpcException on timeout expected");
} catch (SimpleRpcException e) {
// ok, as expected
}
timeoutdispatcher.stopDispatcher();
timeoutdispatcher = null;
}