@SuppressWarnings("InfiniteLoopStatement")
    @Override
    public void run() {
        while(true) try {
            String line = System.console().readLine();
            byte[] encodedMessage = new Message(login, line).encode();
            socket.send(new DatagramPacket(encodedMessage, encodedMessage.length, address, port));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            System.out.println(e.getMessage());
        }
    }