'Set up a resource on a distrib site using L{ResourcePublisher}.
@param child: The resource to publish using distrib.
@return: A tuple consisting of the host and port on which to contact
the created site.'

def _setupDistribServer(self, child):

    distribRoot = resource.Resource()
    distribRoot.putChild('child', child)
    distribSite = server.Site(distribRoot)
    self.f1 = distribFactory = PBServerFactory(distrib.ResourcePublisher(distribSite))
    distribPort = reactor.listenTCP(0, distribFactory, interface='127.0.0.1')
    self.addCleanup(distribPort.stopListening)
    addr = distribPort.getHost()
    self.sub = mainRoot = distrib.ResourceSubscription(addr.host, addr.port)
    mainSite = server.Site(mainRoot)
    mainPort = reactor.listenTCP(0, mainSite, interface='127.0.0.1')
    self.addCleanup(mainPort.stopListening)
    mainAddr = mainPort.getHost()
    return (mainPort, mainAddr)
