from tornado import stack_context
from tornado.tcpserver import TCPServer


class SOCKS4aHandler(object):
    def __init__(self, stream, address, server):
        self.stream = stream
        self.address = address
        self.server = server


class SOCKS4aServer(TCPServer):
    def __init__(self):
        TCPServer.__init__(self)

    def handle_stream(self, stream, address):
        SOCKS4aHandler(stream, address, self)
