synchronized public void close(){
  if (connected) {
    info("Closing socket.");
    try {
      out.close();
      in.close();
      socket.close();
    }
 catch (    IOException ex) {
      warning("Error closing socket: " + ex);
    }
    if (disconnectReason == -1) {
      disconnectReason=Irc.ERROR_CONNECTION_CLOSED;
    }
    if (disconnectMessage == null) {
      disconnectMessage="";
    }
    irc.disconnected(disconnectReason,disconnectMessage);
  }
  connected=false;
}

synchronized public void close ( ) { if ( connected ) { info ( "Closing socket." ) ; try { out . close ( ) ; in . close ( ) ; socket . close ( ) ; } catch ( IOException ex ) { warning ( "Error closing socket: " + ex ) ; } if ( disconnectReason == - 1 ) { disconnectReason = Irc . ERROR_CONNECTION_CLOSED ; } if ( disconnectMessage == null ) { disconnectMessage = "" ; } irc . disconnected ( disconnectReason , disconnectMessage ) ; } connected = false ; }
closes the connection if still connected and cleans up .
