split writeMessage method in ChatClient02 class