@Override
    public void run() {
        try {
            boolean done = false;

            while (!done) {
                byte[] buf = new byte[256];
                DatagramPacket packet = new DatagramPacket(buf, buf.length);

                socket.receive(packet);

                String msg = new String(packet.getData(), 0, packet.getData().length);
                Output.println(msg);

                if (msg.trim().equals("Echo: " + Constants.SHUTDOWN_MESSAGE))
                    done = true;
            }
        } catch (IOException e){
            throw new RuntimeException("can't receive message from server", e);
        }
        finally {
            socket.close();
        }
    }