Refactored for SSL

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