示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expected = IllegalStateException.class) public void shouldThrowWhenWritingOnDisposedChannel()
        public virtual void ShouldThrowWhenWritingOnDisposedChannel()
        {
            // given
            SimpleNettyChannel channel = new SimpleNettyChannel(_nettyChannel, NullLog.Instance);

            channel.Dispose();

            // when
            channel.Write(new object());

            // then expected to throw
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWriteOnNettyChannel()
        public virtual void ShouldWriteOnNettyChannel()
        {
            // given
            SimpleNettyChannel channel = new SimpleNettyChannel(_nettyChannel, NullLog.Instance);

            // when
            object        msg           = new object();
            Future <Void> writeComplete = channel.Write(msg);

            // then
            assertNull(_nettyChannel.readOutbound());
            assertFalse(writeComplete.Done);

            // when
            _nettyChannel.flush();

            // then
            assertTrue(writeComplete.Done);
            assertEquals(msg, _nettyChannel.readOutbound());
        }