'This is called when the connection is first established.'

def connectionMade(self):

    self.line_buffer = ''
    client_address = self.transport.client
    client_address = (client_address[0] if client_address else None)
    self.handshakes = 8
    self.init_session(self.protocol_name, client_address, self.factory.sessionhandler)
    self.sga = suppress_ga.SuppressGA(self)
    self.naws = naws.Naws(self)
    self.ttype = ttype.Ttype(self)
    self.mccp = Mccp(self)
    self.mssp = mssp.Mssp(self)
    self.oob = telnet_oob.TelnetOOB(self)
    self.mxp = Mxp(self)
    self.sessionhandler.connect(self)
    from evennia.utils.utils import delay
    delay(2, callback=self.handshake_done, force=True)
    self.transport.setTcpKeepAlive(1)
    self.protocol_flags['NOPKEEPALIVE'] = True
    self.nop_keep_alive = None
    self.toggle_nop_keepalive()
