upgrade
Wraps an agreed socket in TLS and completes the handshake.
The half of negotiate that runs once the server has said yes, kept separate because the asking and the upgrading happen at different layers — the stream owns the socket and calls this, having been told by negotiate that the server agreed.
Return
The negotiated socket.
Parameters
socket
The plaintext socket the server has agreed to upgrade.
host
The host to verify the certificate against.
port
The port, used when reporting a failure.
config
Mode, trust material and client certificate.
Throws
SSL_ERROR if the handshake or verification fails.