def METHOD_NAME(self):
    """Handle socks5 request according to RFC192."""
    try:
        # Verify socks version
        ver = recvall(self.conn, 1)[0]
        if ver != 0x05:
            raise IOError('Invalid socks version %i' % ver)
        # Choose authentication method
        nmethods = recvall(self.conn, 1)[0]
        methods = bytearray(recvall(self.conn, nmethods))
        method = None
        if 0x02 in methods and self.serv.conf.auth:
            method = 0x02 # username/password
        elif 0x00 in methods and self.serv.conf.unauth:
            method = 0x00 # unauthenticated
        if method is None:
            raise IOError('No supported authentication method was offered')
        # Send response
        self.conn.sendall(bytearray([0x05, method]))
        # Read authentication (optional)
        username = None
        password = None
        if method == 0x02:
            ver = recvall(self.conn, 1)[0]
            if ver != 0x01:
                raise IOError('Invalid auth packet version %i' % ver)
            ulen = recvall(self.conn, 1)[0]
            username = str(recvall(self.conn, ulen))
            plen = recvall(self.conn, 1)[0]
            password = str(recvall(self.conn, plen))
            # Send authentication response
            self.conn.sendall(bytearray([0x01, 0x00]))
        # Read connect request
        ver, cmd, _, atyp = recvall(self.conn, 4)
        if ver != 0x05:
            raise IOError('Invalid socks version %i in connect request' % ver)
        if cmd != Command.CONNECT:
            raise IOError('Unhandled command %i in connect request' % cmd)
        if atyp == AddressType.IPV4:
            addr = recvall(self.conn, 4)
        elif atyp == AddressType.DOMAINNAME:
            n = recvall(self.conn, 1)[0]
            addr = recvall(self.conn, n)
        elif atyp == AddressType.IPV6:
            addr = recvall(self.conn, 16)
        else:
            raise IOError('Unknown address type %i' % atyp)
        port_hi,port_lo = recvall(self.conn, 2)
        port = (port_hi << 8) | port_lo
        # Send dummy response
        self.conn.sendall(bytearray([0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))
        cmdin = Socks5Command(cmd, atyp, addr, port, username, password)
        self.serv.queue.put(cmdin)
        logger.info('Proxy: %s', cmdin)
        # Fall through to disconnect
    except Exception as e:
        logger.exception("socks5 request handling failed.")
        self.serv.queue.put(e)
    finally:
        self.conn.close()