'Setup all required nodes, including the relays, exit nodes and seeder.'

@inlineCallbacks
def setup_nodes(self, num_relays=1, num_exitnodes=1, seed_hops=0):

    assert isInIOThread()
    baseindex = 3
    for i in xrange(baseindex, (baseindex + num_relays)):
        proxy = (yield self.create_proxy(i))
        self.tunnel_communities.append(proxy)
    baseindex += (num_relays + 1)
    for i in xrange(baseindex, (baseindex + num_exitnodes)):
        proxy = (yield self.create_proxy(i, exitnode=True))
        self.tunnel_communities.append(proxy)
    self.setup_tunnel_seeder(seed_hops)
    self.tunnel_communities.append(self.tunnel_community)
    candidates = []
    for session in self.sessions:
        self._logger.debug('Appending    candidate    from    this    session    to    the    list')
        candidates.append(Candidate(session.get_dispersy_instance().lan_address, tunnel=False))
    communities_to_inject = self.tunnel_communities
    if (self.tunnel_community_seeder is not None):
        communities_to_inject.append(self.tunnel_community_seeder)
    for community in communities_to_inject:
        for candidate in candidates:
            self._logger.debug('Add    appended    candidate    as    discovered    candidate    to    this    community')
            community.add_discovered_candidate(candidate)
