docs: def _retrieveRemoteCertificate(self, From, port=port):
          """
          The entire conversation, starting with TCP handshake and ending at
          disconnect, to retrieve a foreign domain's certificate for the first
          time.
          """
          CS = self.service.certificateStorage
          host = str(From.domainAddress())
          p = AMP()
          p.wrapper = self.wrapper
          f = protocol.ClientCreator(reactor, lambda: p)
          connD = f.connectTCP(host, port)
  
          def connected(proto):
              dhost = From.domainAddress()
              iddom = proto.callRemote(Identify, subject=dhost)
              def gotCert(identifyBox):
                  theirCert = identifyBox['certificate']
                  theirIssuer = theirCert.getIssuer().commonName
                  theirName = theirCert.getSubject().commonName
                  if (theirName != str(dhost)):
                      raise VerifyError(
                          "%r claimed it was %r in IDENTIFY response"
                          % (theirName, dhost))
                  if (theirIssuer != str(dhost)):
                      raise VerifyError(
                          "self-signed %r claimed it was issued by "
                          "%r in IDENTIFY response" % (dhost, theirIssuer))
                  def storedCert(ignored):
                      return theirCert
                  return CS.storeSelfSignedCertificate(
                      str(dhost), theirCert).addCallback(storedCert)
              def nothingify(x):
                  proto.transport.loseConnection()
                  return x
              return iddom.addCallback(gotCert).addBoth(nothingify)
          connD.addCallback(connected)
          return connD