def connect(self, credentials):
        assert self.onMessageReceived is not None, \
               "onMessageReceived callback must be set before connecting."
        assert self.onDisconnected is not None, \
                "onDisconnected callback must be set before connecting."
        assert not self.isInInputThread(), \
                "connect was called on an already connected transport."

        deferred = Deferred.Deferred()
        self.startInputLoop(deferred)
        if credentials is not None:
            self.channel.write('CONNECT:%s,%s' % credentials)
        return deferred
dataset/ETHPy150Open ufora/ufora/ufora/networking/InMemoryTransport.py/InMemoryTransport.connect/original