properly initialize SSL context, check return value