@Override
    public void run() {
        try (
            OutputStream outputStream = socket.getOutputStream();
            Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(outputStream, true)
        ) {
            boolean done = false;

            while (!done && in.hasNextLine()) {
                String line = in.nextLine();
                out.println(line);

                if (line.trim().equals(Constants.SHUTDOWN_MESSAGE)) {
                    done = true;
                }
            }
        } catch (IOException e) {
            throw new RuntimeException("can't send data", e);
        } finally {
            try {
                socket.close();
            } catch (IOException e) {
                // ignored
            }
        }
    }