public void close(){
  assertNotNull(client);
  client.setConnectionStatus(ConnectionChangeEvent.Status.DISCONNECTED);
  if (inputThread != null)   inputThread.end();
  if (heartbeatThread != null)   heartbeatThread.end();
  if (outputExecutor != null)   outputExecutor.shutdownNow();
  try {
    if (channel != null)     channel.close();
    if (socket != null)     socket.close();
  }
 catch (  Exception e) {
  }
}

public void close ( ) { assertNotNull ( client ) ; client . setConnectionStatus ( ConnectionChangeEvent . Status . DISCONNECTED ) ; if ( inputThread != null ) inputThread . end ( ) ; if ( heartbeatThread != null ) heartbeatThread . end ( ) ; if ( outputExecutor != null ) outputExecutor . shutdownNow ( ) ; try { if ( channel != null ) channel . close ( ) ; if ( socket != null ) socket . close ( ) ; } catch ( Exception e ) { } }
closes the connection and interrupts all threads this connection has spawned .
