added selector to the client instead of the busy loop, and fixed the
stuck after 1 message in ConnectionHandler