I've just spotted that the acceptor is not correctly disposed.
I've managed to get the test running succesfully by adding the
following code just after server.suspend()
for (Listener listener :
server.getServerContext().getListeners().values()) {
if (listener instanceof NioListener) {
Field field = listener.getClass().getDeclaredField("acceptor");
field.setAccessible(true);
NioSocketAcceptor acceptor = (NioSocketAcceptor)
field.get(listener);
Method method =
AbstractPollingIoAcceptor.class.getDeclaredMethod("dispose0");
method.setAccessible(true);
method.invoke(acceptor);
}
}
Which is about callling the dispose0() method of the NioSocketAcceptor.
This method looks like:
protected IoFuture dispose0() throws Exception {
unbind();
if (!disposalFuture.isDone()) {
startupAcceptor();
wakeup();
}
return disposalFuture;
}
So I guess what we're missing is a call to:
startupAcceptor();
wakeup();
somewhere.
I'm not too familiar with mina internals, so I'm not sure where this
methods should be called or if it makes any sense to call those after
an unbind.
2009/2/24 Emmanuel Lecharny <[email protected]>:
> On Tue, Feb 24, 2009 at 4:36 PM, Guillaume Nodet <[email protected]> wrote:
>> Maybe not the suspend call directly, but as a side effect.
>> If the server is not started, the correct expceiton if thrown by the client.
>> If the server is suspended and restarted, then the client connects correctly.
>
> yeah, probably. I suspect that the acceptor is not stopped correctly.
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com