Add TLS support

If config::

    main.tls=true

then secure connection is attempted