示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldExcludeChannelsWithoutInstalledProtocol()
        public virtual void ShouldExcludeChannelsWithoutInstalledProtocol()
        {
            // given
            _reconnectingChannels.putIfAbsent(_to1, _channel1);
            _reconnectingChannels.putIfAbsent(_to2, _channel2);
            ProtocolStack protocolStack1 = new ProtocolStack(TestProtocols_TestApplicationProtocols.RAFT_3, emptyList());

            Mockito.when(_channel1.installedProtocolStack()).thenReturn(protocolStack1);
            Mockito.when(_channel2.installedProtocolStack()).thenReturn(null);

            // when
            Stream <Pair <AdvertisedSocketAddress, ProtocolStack> > installedProtocols = _reconnectingChannels.installedProtocols();

            // then
            assertThat(installedProtocols, contains(Pair.of(_to1, protocolStack1)));
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnStreamOfInstalledProtocolsForChannelsThatHaveCompletedHandshake()
        public virtual void ShouldReturnStreamOfInstalledProtocolsForChannelsThatHaveCompletedHandshake()
        {
            // given
            _reconnectingChannels.putIfAbsent(_to1, _channel1);
            _reconnectingChannels.putIfAbsent(_to2, _channel2);
            ProtocolStack protocolStack1 = new ProtocolStack(TestProtocols_TestApplicationProtocols.RAFT_3, emptyList());
            ProtocolStack protocolStack2 = new ProtocolStack(TestProtocols_TestApplicationProtocols.RAFT_2, emptyList());

            Mockito.when(_channel1.installedProtocolStack()).thenReturn(protocolStack1);
            Mockito.when(_channel2.installedProtocolStack()).thenReturn(protocolStack2);

            // when
            Stream <Pair <AdvertisedSocketAddress, ProtocolStack> > installedProtocols = _reconnectingChannels.installedProtocols();

            // then
            Stream <Pair <AdvertisedSocketAddress, ProtocolStack> > sorted = installedProtocols.sorted(System.Collections.IComparer.comparing(p => p.first().Hostname));

            assertThat(sorted, contains(Pair.of(_to1, protocolStack1), Pair.of(_to2, protocolStack2)));
        }