if (connection != null) { connection.close(); connection = null;
try { socket.close(); in.close(); out.close(); } catch (IOException e) { e.printStackTrace(); } catch (NullPointerException e) {
    public void die() {        // If we're still connected, tell the server that we're going down.        if (connected) {            send(new Packet(Packet.COMMAND_CLOSE_CONNECTION));        }        connected = false;        if (connection != null) {            connection.close();            connection = null;        }                for (int i = 0; i < closeClientListeners.size(); i++){            ((CloseClientListener)closeClientListeners.elementAt(i)).clientClosed();        }        if (serverlog != null) {            try {                serverlog.close();            } catch (IOException e) {                System.err.print("Exception closing logfile: "); //$NON-NLS-1$                e.printStackTrace();            }        }        System.out.println("client: died"); //$NON-NLS-1$            }