Example #1
0
 public BoltChannel(string id, string connector, Channel rawChannel)
 {
     this._id          = id;
     this._connectTime = DateTimeHelper.CurrentUnixTimeMillis();
     this._connector   = connector;
     this._rawChannel  = rawChannel;
     this._info        = CreateConnectionInfo();
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void connectionDetailsForHttpQuerySource()
        public virtual void ConnectionDetailsForHttpQuerySource()
        {
            // given
            ClientConnectionInfo clientConnection = (new HttpConnectionInfo("http-42", "http", new InetSocketAddress("127.0.0.1", 1337), null, "/db/data/transaction/45/commit")).withUsername("username");

            // when
            string connectionDetails = clientConnection.AsConnectionDetails();

            // then
            assertEquals("server-session\thttp\t127.0.0.1\t/db/data/transaction/45/commit\tusername", connectionDetails);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void connectionDetailsForBoltQuerySource()
        public virtual void ConnectionDetailsForBoltQuerySource()
        {
            // given
            ClientConnectionInfo clientConnection = (new BoltConnectionInfo("bolt-42", "username", "neo4j-java-bolt-driver", new InetSocketAddress("127.0.0.1", 56789), new InetSocketAddress("127.0.0.1", 7687))).withUsername("username");

            // when
            string connectionDetails = clientConnection.AsConnectionDetails();

            // then
            assertEquals("bolt-session\tbolt\tusername\tneo4j-java-bolt-driver\t\tclient/127.0.0.1:56789\t" + "server/127.0.0.1:7687>\tusername", connectionDetails);
        }
Example #4
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"));
        }
Example #5
0
 public override void UpdateUser(string username, string userAgent)
 {
     this._username  = username;
     this._userAgent = userAgent;
     this._info      = CreateConnectionInfo();
 }