Refactor Client.processMessage()