Refactor sockets for SSL

Refactored client sockets to support SSL/TLS and updated unit tests