def __init__(self, settings = None, sock = None):
if settings:<EOL><INDENT>self.settings = settings<EOL><DEDENT>else:<EOL><INDENT>self.settings = XMPPSettings()<EOL><DEDENT>self.lock = threading.RLock()<EOL>self._write_queue = deque()<EOL>self._write_queue_cond = threading.Condition(self.lock)<EOL>self._eof = False<EOL>self._hup = False<EOL>self._stream = None<EOL>self._serializer = None<EOL>self._reader = None<EOL>self._dst_name = None<EOL>self._dst_port = None<EOL>self._dst_service = None<EOL>self._dst_nameports = None<EOL>self._dst_hostname = None<EOL>self._dst_addrs = None<EOL>self._tls_state = None<EOL>self._state_cond = threading.Condition(self.lock)<EOL>if sock is None:<EOL><INDENT>self._socket = None<EOL>self._dst_addr = None<EOL>self._family = None<EOL>self._state = None<EOL><DEDENT>else:<EOL><INDENT>self._socket = sock<EOL>self._family = sock.family<EOL>self._dst_addr = sock.getpeername()<EOL>self._state = "<STR_LIT>"<EOL>self._socket.setblocking(False)<EOL><DEDENT>self._event_queue = self.settings["<STR_LIT>"]<EOL>self._auth_properties = {}<EOL>
Initialize the `TCPTransport` object.

        :Parameters:
            - `settings`: XMPP settings to use
            - `sock`: existing socket, e.g. for accepted incoming connection.