Refactorize connectors to use them in client and server

After implement pull request #53 I realized that we could extract more the connectors to use them in client and server without repeating logic.