Hello,
I have not done extensive testing/debugging, but I peaked at the code and I think there is a bug. isOpen() says it doesn't throw a SocketException. However, if you look at it's implementation, it does in fact call isConnected() which throws the Exception, and I never get the 'false' returned to me.
I think you'll need to surround it with a try/catch block and handle that exception if you don't want it to throw one (even if indirectly).
The way I can replicate this error is I keep a ConcurrentHashMap<String, ClientHandler>....and then I manually disconnect those clients. When I iterate that ConcurrentHashMap, and call isOpen(), I want to move it from one map to the other if it is NOT open.
Below is some of the relevant code from org.quickserver.net.server.impl.BasicClientHandler
-Dwayne
/**
* Checks if the client is still connected.
* @exception SocketException if Socket is not open.
* @since 1.4.5
*/
public boolean isConnected() throws SocketException {
if(isOpen()==false)
throw new SocketException("Connection is no more open!");
else
return true;
}
/**
* Checks if the client is still connected and if socket is open. This is same as isConnected()
* but does not throw SocketException.
* @since 1.4.6
*/
public boolean isOpen() {
if(lost==true || socket==null || socket.isConnected()==false || socket.isClosed()==true)
return false;
else
return true;
}