public void TestValidity()
        {
            var publisherAvailability = new PublisherAvailability("test-dir", "1.2.3.4", 111);

            Assert.True(publisherAvailability.IsValid);
            Assert.False(PublisherAvailability.From("blah").IsValid);
            Assert.True(PublisherAvailability.From(textMessage).IsValid);
        }
        //====================================
        // internal implementation
        //====================================

        private void ManageDirectoryChannel(string maybePublisherAvailability)
        {
            var publisherAvailability = PublisherAvailability.From(maybePublisherAvailability);

            if (publisherAvailability.IsValid)
            {
                if (!publisherAvailability.Equals(_directory !))
                {
                    _directory = publisherAvailability;
                    _directoryChannel?.Close();
                    _directoryChannel = new SocketChannelWriter(_testAddress ?? _directory.ToAddress(), Logger);
                }
            }
        }
Ejemplo n.º 3
0
    private void ManageDirectoryChannel(string maybePublisherAvailability)
    {
        var publisherAvailability = PublisherAvailability.From(maybePublisherAvailability);

        if (publisherAvailability.IsValid)
        {
            if (!publisherAvailability.Equals(_directory !))
            {
                Logger.Debug($"DIRECTORY CLIENT [{_id}]: Initializing socket...");
                _directory = publisherAvailability;
                PrepareDirectoryChannel();
            }
        }
    }
        public void TestMessage()
        {
            var publisherAvailability = new PublisherAvailability("test-dir", "1.2.3.4", 111);

            Assert.Equal(publisherAvailability, PublisherAvailability.From(textMessage));
        }