Add support for secure connections (https)

If the implementation is ok I can add:
- a test certificate,
- unit tests.