public static void main(String[] args) {
        Socket clientSocket;
        BufferedReader inFromUser;
        DataOutputStream outToServer;
        BufferedReader inFromServer;
        String writeUser;
        String messageToServer;

        try {
            clientSocket = initSocket(HOST, PORT);
            outToServer = new DataOutputStream(clientSocket.getOutputStream());
            inFromServer = new BufferedReader(new InputStreamReader(
                    clientSocket.getInputStream()));

            inFromUser = new BufferedReader(new InputStreamReader(System.in));

            while (makeChat) {
                writeUser = inFromUser.readLine()+  "\r\n";

                outToServer.write(writeUser.getBytes("UTF-8"));

                messageToServer = inFromServer.readLine();

                System.out.println("FROM SERVER: " + messageToServer);

                if (messageToServer.startsWith("BYE") || messageToServer.startsWith("OK_BYE")) makeChat = false;

            }
            clientSocket.close();
        } catch (IOException e) {
            System.exit(1);
        }
        System.out.println("client is stopped!");
    }