Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRemoveChannelViaCallback()
        public virtual void ShouldRemoveChannelViaCallback()
        {
            // given
            AdvertisedSocketAddress address  = new AdvertisedSocketAddress("localhost", 1984);
            ReconnectingChannels    channels = new ReconnectingChannels();

            channels.PutIfAbsent(address, mock(typeof(ReconnectingChannel)));

            IdleChannelReaperHandler reaper = new IdleChannelReaperHandler(channels);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.net.InetSocketAddress socketAddress = address.socketAddress();
            InetSocketAddress socketAddress = address.SocketAddressConflict();

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final io.netty.channel.Channel channel = mock(io.netty.channel.Channel.class);
            Channel channel = mock(typeof(Channel));

            when(channel.remoteAddress()).thenReturn(socketAddress);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final io.netty.channel.ChannelHandlerContext context = mock(io.netty.channel.ChannelHandlerContext.class);
            ChannelHandlerContext context = mock(typeof(ChannelHandlerContext));

            when(context.channel()).thenReturn(channel);

            // when
            reaper.UserEventTriggered(context, IdleStateEvent.ALL_IDLE_STATE_EVENT);

            // then
            assertNull(channels.Get(address));
        }
Exemplo n.º 2
0
 public IdleChannelReaperHandler(ReconnectingChannels channels)
 {
     this._channels = channels;
 }
Exemplo n.º 3
0
 public SenderService(ChannelInitializer channelInitializer, LogProvider logProvider)
 {
     this._channelInitializer = channelInitializer;
     this._log      = logProvider.getLog(this.GetType());
     this._channels = new ReconnectingChannels();
 }