Long ago I used stunnel to establish encrypted connections to remotely access my sockets servers.
It didn't really matter what the protocol was, the client and server just see each other. IIRC it was also possible to connect a browser with https to a tunneled http server or viceversa.