Refactored echo_client.py