I understand that. The problem I'm facing is that unless I write "reactor.run()" my client isn't starting up. From what I understood in the trial documentation, I should simply call the connectTCP method and then return a deferred. However, if I do that, the client isn't starting. I'll post some of the client code for you info :<br>
class SimpleTransport(transport.SSHClientTransport):<br> def verifyHostKey(self, hostKey, fingerprint):<br> print 'host key fingerprint: %s' % fingerprint<br> return defer.succeed(1) <br><br> def connectionSecure(self):<br>
self.requestService(<br> SimpleUserAuth('webchick',<br> SimpleConnection()))<br><br>class SimpleUserAuth(userauth.SSHUserAuthClient):<br> def getPassword(self):<br> return defer.succeed("Thai1mil3ahb") <br>
def getPublicKey(self):<br> print "trying public key"<br> path = os.path.expanduser('~/.ssh/id_rsa') <br> # this works with rsa too <br> # just change the name here and in getPrivateKey<br>
if not os.path.exists(path) or self.lastPublicKey:<br> # the file doesn't exist, or we've tried a public key<br> return<br> return keys.Key.fromFile(filename=path+'.pub',passphrase='pikachu').blob()<br>
<br> def getPrivateKey(self):<br> path = os.path.expanduser('~/.ssh/id_rsa')<br> return defer.succeed(keys.Key.fromFile(path,passphrase='pikachu').keyObject)<br>Now , in my test case :<br>
def test_1(self):<br> def got_data(data):<br> self.assertEquals(data,"a")<br> d = protocol.ClientCreator(reactor, SimpleTransport).connectTCP('localhost', self.server.getHost().port)<br>
d.addCallback(got_data)<br> return d<br>The callback is firing, but the client is not started and *data* is a SimpleTransport Instance.<br>Any thoughts on why this is happening and what I am doing wrong? <br>