add SSL support

Adding SSL support. Tested against stunnel on the server side.