Encapsulate the socket inside the client