TooTallNate/Java-WebSocket — Issue #50: UnresolvedAddressException causes thread termination
Author: vijayraghunathan
Created: 2011-12-14 08:05:09+00:00
State: open

If you try to connect when there is no internet connection the run thread will throw this Exception which *doesn't* inherit from IOException. THis causes the run method to fail (which can lead to a crash).

It's not possible to always determine if the connection is going to be present before we try to connect. Personally I think it's silly that this exception doesn't inherit from IOException since it's potentially caused by that sort of failure, but I think that the websocket library should be resilient to this sort of failure.

One possible solution is to add another method onException or onAddressException in WebSocketClient that gets called when this sort of error occurs. Using the existing onIOError callback is not possible because this function expects an IOException.