diff --git a/src/org/java_websocket/WebSocketImpl.java b/src/org/java_websocket/WebSocketImpl.java index 4d8d5fe29..4203b1ae5 100644 --- a/src/org/java_websocket/WebSocketImpl.java +++ b/src/org/java_websocket/WebSocketImpl.java @@ -404,12 +404,12 @@ protected synchronized void closeConnection( int code, String message, boolean r if( key != null ) { // key.attach( null ); //see issue #114 key.cancel(); - try { - channel.close(); - } catch ( IOException e ) { - wsl.onWebsocketError( this, e ); - } - } + } + try { + channel.close(); + } catch ( IOException e ) { + wsl.onWebsocketError( this, e ); + } // sockchannel.close(); this.wsl.onWebsocketClose( this, code, message, remote ); if( draft != null )