예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @SuppressWarnings("deprecation") void shouldExposeClientConnectionInfo()
        internal virtual void ShouldExposeClientConnectionInfo()
        {
            EmbeddedChannel channel     = new EmbeddedChannel();
            BoltChannel     boltChannel = new BoltChannel("bolt-42", "my-bolt", channel);

            ClientConnectionInfo info1 = boltChannel.Info();

            assertEquals("bolt-42", info1.ConnectionId());
            assertEquals("bolt", info1.Protocol());
            assertEquals(SocketAddress.format(channel.remoteAddress()), info1.ClientAddress());

            boltChannel.UpdateUser("Tom", "my-driver");

            ClientConnectionInfo info2 = boltChannel.Info();

            assertEquals("bolt-42", info2.ConnectionId());
            assertEquals("bolt", info2.Protocol());
            assertEquals(SocketAddress.format(channel.remoteAddress()), info2.ClientAddress());
            assertThat(info2.AsConnectionDetails(), containsString("Tom"));
            assertThat(info2.AsConnectionDetails(), containsString("my-driver"));
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDisableAutoReadWhenAtHighWatermark()
        public virtual void ShouldDisableAutoReadWhenAtHighWatermark()
        {
            BoltConnectionReadLimiter limiter = NewLimiter(1, 2);

            assertTrue(_channel.config().AutoRead);

            limiter.Enqueued(_connection, _job);
            limiter.Enqueued(_connection, _job);
            limiter.Enqueued(_connection, _job);

            assertFalse(_channel.config().AutoRead);
            verify(_log).warn(contains("disabled"), eq(_channel.remoteAddress()), eq(3));
        }