'Once the necessary SSH actions have completed successfully,
L{SSHCommandClientEndpoint.connect} uses the factory passed to it to
construct a protocol instance by calling its C{buildProtocol} method
with an address object representing the SSH connection and command
executed.'

def test_buildProtocol(self):

    self.realm.channelLookup['session'] = WorkingExecSession
    endpoint = self.create()
    factory = AddressSpyFactory()
    factory.protocol = Protocol
    endpoint.connect(factory)
    (server, client, pump) = self.finishConnection()
    self.assertIsInstance(factory.address, SSHCommandAddress)
    self.assertEqual(server.transport.getHost(), factory.address.server)
    self.assertEqual(self.user, factory.address.username)
    self.assertEqual('/bin/ls    -l', factory.address.command)
