The function ssl.wrap_socket() is deprecated starting Python 3.7 because
it does not support hostname matching (which is considered insecure). In
Python 3.10, the function now throws warnings at runtime, which makes
Ubuntu / Debian autopkgtest fail.
The function ssl.SSLContext.wrap_socket comes in as the replacement and
has support for SNI and hostname matching.
Replaced all uses of ssl.wrap_socket() by equivalent using
ssl.SSLContext.wrap_socket().
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>