Le 10/1/12 4:43 PM, Emmanuel Lécharny a écrit :
Le 10/1/12 4:13 PM, Emmanuel Lécharny a écrit :
Le 10/1/12 4:01 PM, Julien Vermillard a écrit :
finally -1 :
Running org.apache.mina.transport.socket.nio.DatagramSessionIdleTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.028
sec
<<< FAILURE!
Damn it... Seems like it passes on OSX, but not on Ubuntu :/
There is a failure due to some IPV4/IPV6 address mismatches. I'll try to
get it fixed asap.
So the problem is that when we bind on the server using this address :
InetSocketAddress bindAddress = new
InetSocketAddress(AvailablePortFinder.getNextAvailable());
(which is 0.0.0.0:XYZT)
the server create the DatagramChannel :
protected DatagramChannel open(SocketAddress localAddress) throws
Exception {
final DatagramChannel c = DatagramChannel.open();
boolean success = false;
try {
new NioDatagramSessionConfig(c).setAll(getSessionConfig());
c.configureBlocking(false);
c.socket().bind(localAddress);
c.register(selector, SelectionKey.OP_READ);
success = true;
} finally {
if (!success) {
close(c);
}
}
return c;
}
and then store the channel's address in the boundedHandles map :
for (SocketAddress socketAddress : localAddresses) {
H handle = open(socketAddress);
newHandles.put(localAddress(handle), handle);
}
boundHandles.putAll(newHandles);
Here, the localAddress(handle) method does :
protected SocketAddress localAddress(DatagramChannel handle) throws
Exception {
return handle.socket().getLocalSocketAddress();
}
which returns 0:0:0:0:0:0:0:0:XYZT, an IPV6 address :/
So we have now an IPV6 address stored in the map, but when we do in the
test :
IoSession session = acceptor.newSession(
new InetSocketAddress("127.0.0.1",
AvailablePortFinder.getNextAvailable()), bindAddress);
the bindAddress is an IPV4 address, it it won't be found :/
If anyone has an idea on how to fix that properly...
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com