def wrap(cls, meth):
        '''
        Wraps a connection opening method in this class.
        '''

        async def inner(*args, **kwargs):
            sock = await meth(*args, **kwargs)
            return cls(sock)

        return inner
Wraps a connection opening method in this class.