// start NIO framework
Dispatcher dispatcher = new Dispatcher();
dispatcher.start();
MyClientSocketChannelHandler handler =
new MyClientSocketChannelHandler();
dispatcher.registerClientSocketChannelHandler(
"öäü.öäü", 0, handler, 3000);
// wait until resolveFailed() was called by the framework
for (int i = 0; !handler.hasResolveFailed() && (i < 30); i++) {
Thread.sleep(1000);
}
assertTrue("resolveFailed() was never called!",
handler.hasResolveFailed());
// check that connectFailed() will not be called too, because of the
// timeout
Thread.sleep(4000);
assertFalse("connectFailed() was called too",
handler.hasConnectFailed());
}