Make SSL connections work

Fixed and added a test