public void run() {
        try {
            in = new ObjectInputStream(connection.getInputStream());
        } catch (IOException ex) {
            Logger.getLogger(ILServer.class.getName()).log(Level.SEVERE, null, ex);
            return;
        }

        boolean going = true;
        MessageObj incoming;

        while (going) {
            try {
                incoming = (MessageObj) in.readObject();
                takeAction(incoming, address, out);
                
                if (incoming.getMsgType() == 2) {
                    in.close();
                    out.close();
                    connection.close();
                    going = false;
                    return;
                }
            } catch (IOException ex) {
                Logger.getLogger(ILServer.class.getName()).log(Level.SEVERE, null, ex);
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(ILServer.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }