private void Build()
        {
            var socketFactory       = new SocketFactory();
            var perfCountersManager = CreatePerfCountersManager();
            var localSocketFactory  = new LocalSocketFactory();
            var routerLocalSocket   = localSocketFactory.Create <IMessage>();

            var internalRoutingTable         = new InternalRoutingTable();
            var externalRoutingTable         = new ExternalRoutingTable(logger);
            var scaleOutConfigurationManager = new ScaleOutConfigurationManager(configurationProvider.GetRouterConfiguration(),
                                                                                configurationProvider.GetScaleOutConfiguration());

            var rendezvousConfigurationStorage = new RendezvousClusterConfigurationReadonlyStorage(configurationProvider.GetRendezvousEndpointsConfiguration());
            var rendezvousCluster = new RendezvousCluster(rendezvousConfigurationStorage);
            var securityProider   = new SecurityProvider(() => HMAC.Create("HMACMD5"),
                                                         domainScopeResolver,
                                                         domainPrivateKeyProvider);
            var autoDiscoverSender = new AutoDiscoverySender(rendezvousCluster,
                                                             scaleOutConfigurationManager,
                                                             socketFactory,
                                                             perfCountersManager,
                                                             securityProider,
                                                             logger);
            var autoDiscoverListener = new AutoDiscoveryListener(rendezvousCluster,
                                                                 socketFactory,
                                                                 scaleOutConfigurationManager,
                                                                 autoDiscoverSender,
                                                                 configurationProvider.GetClusterMembershipConfiguration(),
                                                                 perfCountersManager,
                                                                 securityProider,
                                                                 routerLocalSocket,
                                                                 logger);
            var routeDiscovery = new RouteDiscovery(autoDiscoverSender,
                                                    scaleOutConfigurationManager,
                                                    configurationProvider.GetClusterMembershipConfiguration(),
                                                    securityProider,
                                                    logger);
            var heartBeatSenderConfigurationManager = new HeartBeatSenderConfigurationManager(configurationProvider.GetHeartBeatSenderConfiguration());
            var clusterConnectivity = new ClusterConnectivity(configurationProvider.GetClusterMembershipConfiguration(),
                                                              scaleOutConfigurationManager,
                                                              autoDiscoverSender,
                                                              autoDiscoverListener,
                                                              routeDiscovery,
                                                              socketFactory,
                                                              routerLocalSocket,
                                                              scaleOutConfigurationManager,
                                                              securityProider,
                                                              perfCountersManager,
                                                              logger,
                                                              heartBeatSenderConfigurationManager,
                                                              localSocketFactory,
                                                              configurationProvider.GetClusterHealthMonitorConfiguration());
            var internalRegistrationsSocket  = localSocketFactory.Create <InternalRouteRegistration>();
            var internalRegistrationsHandler = new InternalMessageRouteRegistrationHandler(clusterConnectivity,
                                                                                           internalRoutingTable,
                                                                                           securityProider,
                                                                                           logger);

            messageRouter = new MessageRouter(socketFactory,
                                              internalRoutingTable,
                                              externalRoutingTable,
                                              scaleOutConfigurationManager,
                                              clusterConnectivity,
                                              CreateServiceMessageHandlers(clusterConnectivity,
                                                                           externalRoutingTable,
                                                                           internalRoutingTable,
                                                                           securityProider),
                                              perfCountersManager,
                                              securityProider,
                                              routerLocalSocket,
                                              internalRegistrationsSocket,
                                              internalRegistrationsHandler,
                                              logger);

            actorHostManager = new ActorHostManager(securityProider,
                                                    perfCountersManager,
                                                    routerLocalSocket,
                                                    internalRegistrationsSocket,
                                                    localSocketFactory,
                                                    logger);
            var callbackHandlerStack = new CallbackHandlerStack();

            messageHub = new MessageHub(callbackHandlerStack,
                                        perfCountersManager,
                                        routerLocalSocket,
                                        internalRegistrationsSocket,
                                        localSocketFactory,
                                        logger,
                                        false);
        }
 public RendezvousClusterConfigurationReadonlyStorageTests()
 {
     initialConfiguration = Randomizer.Int32(3, 6)
                            .Produce(i => new RendezvousEndpoint($"tcp://*:808{i}", $"tcp://*:909{i}"));
     configStorage = new RendezvousClusterConfigurationReadonlyStorage(initialConfiguration);
 }