Extracted createSecureConnection to its own module.
Added the CLI test and new options for secure.