def testPASV(self):
# Login
yield defer.waitForDeferred(self._anonymousLogin())
# Issue a PASV command, and extract the host and port from the response
pasvCmd = defer.waitForDeferred(self.client.queueStringCommand('PASV'))
yield pasvCmd
responseLines = pasvCmd.getResult()
host, port = ftp.decodeHostPort(responseLines[-1][4:])
# Make sure the server is listening on the port it claims to be
self.assertEqual(port, self.serverProtocol.dtpPort.getHost().port)
# Semi-reasonable way to force cleanup
self.serverProtocol.connectionLost(error.ConnectionDone())
评论列表
文章目录