internal WorkerNode()
        {
            Defaults(s => s.Set("Worker.Enabled", true));
            Defaults(s =>
            {
                var masterNodeAddress = MasterNodeConfiguration.GetMasterNodeAddress(s);
                s.Set("MasterNode.Address", masterNodeAddress);
                s.Set("PublicReturnAddress", masterNodeAddress);

                if (!string.IsNullOrEmpty(MasterNodeConfiguration.GetMasterNode(s)))
                {
                    s.SetDefault("SecondLevelRetries.AddressOfRetryProcessor", masterNodeAddress.SubScope("Retries"));
                }
            });
            Defaults(s =>
            {
                var workerName = ConfigurationManager.AppSettings.Get("NServiceBus/Distributor/WorkerNameToUseWhileTesting");

                if (!String.IsNullOrEmpty(workerName))
                {
                    s.Set("NServiceBus.LocalAddress", workerName);
                }
            });
            RegisterStartupTask <ReadyMessageSender>();
        }
        static void ValidateMasterNodeAddress(ReadOnlySettings settings)
        {
            var masterNodeName = MasterNodeConfiguration.GetMasterNode(settings);

            if (masterNodeName == null)
            {
                throw new ConfigurationErrorsException(
                          "When defining Worker profile, 'MasterNodeConfig' section must be defined and the 'Node' entry should point to a valid host name.");
            }

            switch (IsLocalIpAddress(masterNodeName))
            {
            case true:
                throw new ConfigurationErrorsException(string.Format("'MasterNodeConfig.Node' points to a local host name: [{0}]", masterNodeName));

            case false:
                logger.InfoFormat("'MasterNodeConfig.Node' points to a non-local valid host name: [{0}].", masterNodeName);
                break;

            case null:
                throw new ConfigurationErrorsException(
                          string.Format("'MasterNodeConfig.Node' entry should point to a valid host name. Currently it is: [{0}].", masterNodeName));
            }
        }