Correct exception handling in client-server connect and chat methods.