docs: def connectQ2Q(self, fromAddress, toAddress, protocolName, protocolFactory,
                     usePrivateCertificate=None, fakeFromDomain=None,
                     chooser=None):
          """
          Connect a named protocol factory from a resource@domain to a
          resource@domain.
  
          This is analagous to something like connectTCP, in that it creates a
          connection-oriented transport for each connection, except instead of
          specifying your credentials with an application-level (username,
          password) and your endpoint with a framework-level (host, port), you
          specify both at once, in the form of your ID (user@my-domain), their ID
          (user@their-domain) and the desired protocol.  This provides several
          useful features:
  
              - All connections are automatically authenticated via SSL
                certificates, although not authorized for any particular
                activities, based on their transport interface rather than having
                to have protocol logic to authenticate.
  
              - User-meaningful protocol nicknames are attached to
                implementations of protocol logic, rather than arbitrary
                numbering.
  
              - Endpoints can specify a variety of transport mechanisms
                transparently to the application: for example, you might be
                connecting to an authorized user-agent on the user's server or to
                the user directly using a NAT-circumvention handshake.  All the
                application has to know is that it wants to establish a TCP-like
                connection.
  
          XXX Really, really should return an IConnector implementor for symmetry
          with other connection-oriented transport APIs, but currently does not.
  
          The 'resource' parameters are so named (rather than beginning with
          'user', for example) because they are sometimes used to refer to
          abstract entities or roles, such as 'payments', or groups of users
          (communities) but generally the convention is to document them as
          individual users for simplicity's sake.
  
          The parameters are described as if Alice <alice@divmod.com> were trying
          try connect to Bob <bob@notdivmod.com> to transfer a file over HTTP.
  
          @param fromAddress: The address of the connecting user: in this case,
          Q2QAddress("divmod.com", "alice")
  
          @param toAddress: The address of the user connected to: in this case,
          Q2QAddress("notdivmod.com", "bob")
  
          @param protocolName: The name of the protocol, by convention observing
          similar names to http://www.iana.org/assignments/port-numbers when
          appropriate.  In this case, 'http'.
  
          @param protocolFactory: An implementation of
          L{twisted.internet.interfaces.IProtocolFactory}
  
          @param usePrivateCertificate: Use a different private certificate for
          initiating the 'secure' call.  Mostly for testing different invalid
          certificate attacks.
  
          @param fakeFromDomain: This domain name will be used for an argument to
          the 'connect' command, but NOT as an argument to the SECURE command.
          This is to test a particular kind of invalid cert attack.
  
          @param chooser: a function taking a list of connection-describing
          objects and returning another list.  Those items in the remaining list
          will be attempted as connections and buildProtocol called on the client
          factory.  May return a Deferred.
  
          @default chooser: C{lambda x: x and [x[0]]}
  
          @return:
          """
          if chooser is None:
              chooser = lambda x: x and [x[0]]
  
          def onSecureConnection(protocol):
              if fakeFromDomain:
                  connectFromAddress = Q2QAddress(
                      fakeFromDomain,
                      toAddress.resource
                  )
              else:
                  connectFromAddress = fromAddress
  
              return protocol.connect(connectFromAddress, toAddress,
                                      protocolName, protocolFactory,
                                      chooser)
  
          def onSecureConnectionFailure(reason):
              protocolFactory.clientConnectionFailed(None, reason)
              return reason
  
          return self.getSecureConnection(
              fromAddress, toAddress,
              port, usePrivateCertificate).addCallback(
              onSecureConnection).addErrback(onSecureConnectionFailure)