//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void testFailureWithUnpackableValue(org.neo4j.function.ThrowingConsumer<org.neo4j.bolt.messaging.Neo4jPack_Packer, java.io.IOException> valuePacker, String expectedMessage) throws Exception private void TestFailureWithUnpackableValue(ThrowingConsumer <Org.Neo4j.Bolt.messaging.Neo4jPack_Packer, IOException> valuePacker, string expectedMessage) { _connection.connect(_address).send(_util.defaultAcceptedVersions()); assertThat(_connection, _util.eventuallyReceivesSelectedProtocolVersion()); _connection.send(_util.chunk(new InitMessage(USER_AGENT, Collections.emptyMap()))); assertThat(_connection, _util.eventuallyReceives(msgSuccess())); _connection.send(_util.chunk(64, CreateRunWith(valuePacker))); assertThat(_connection, _util.eventuallyReceives(msgFailure(Org.Neo4j.Kernel.Api.Exceptions.Status_Statement.TypeError, expectedMessage))); assertThat(_connection, eventuallyDisconnects()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCloseUnencryptedConnectionOnHandshakeWhenEncryptionIsRequired() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCloseUnencryptedConnectionOnHandshakeWhenEncryptionIsRequired() { // When _client.connect(_address).send(_util.acceptedVersions(1, 0, 0, 0)); assertThat(_client, eventuallyDisconnects()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void sendingButNotReceivingClientShouldBeKilledWhenWriteThrottleMaxDurationIsReached() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SendingButNotReceivingClientShouldBeKilledWhenWriteThrottleMaxDurationIsReached() { int numberOfRunDiscardPairs = 10_000; string largeString = StringUtils.repeat(" ", 8 * 1024); _client.connect(_address).send(_util.acceptedVersions(1, 0, 0, 0)).send(_util.chunk(new InitMessage("TestClient/1.1", emptyMap()))); assertThat(_client, eventuallyReceives(new sbyte[] { 0, 0, 0, 1 })); assertThat(_client, _util.eventuallyReceives(msgSuccess())); Future sender = OtherThread.execute(state => { for (int i = 0; i < numberOfRunDiscardPairs; i++) { _client.send(_util.chunk(new RunMessage("RETURN $data as data", ValueUtils.asMapValue(singletonMap("data", largeString))), PullAllMessage.INSTANCE)); } return(null); }); try { OtherThread.get().awaitFuture(sender); fail("should throw ExecutionException instead"); } catch (ExecutionException e) { assertThat(Exceptions.rootCause(e), instanceOf(typeof(SocketException))); } _logProvider.assertAtLeastOnce(inLog(Matchers.containsString(typeof(BoltConnection).Assembly.GetName().Name)).error(startsWith("Unexpected error detected in bolt session"), hasProperty("cause", matchesExceptionMessage(containsString("will be closed because the client did not consume outgoing buffers for "))))); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected void negotiateBoltV3() throws Exception protected internal virtual void NegotiateBoltV3() { Connection.connect(Address).send(Util.acceptedVersions(3, 0, 0, 0)).send(Util.chunk(new HelloMessage(MapUtil.map("user_agent", USER_AGENT)))); assertThat(Connection, eventuallyReceives(new sbyte[] { 0, 0, 0, 3 })); assertThat(Connection, Util.eventuallyReceives(msgSuccess())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCloseConnectionOnInvalidHandshake() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCloseConnectionOnInvalidHandshake() { // GIVEN Connection.connect(_address); // WHEN Connection.send(new sbyte[] { unchecked (( sbyte )0xDE), unchecked (( sbyte )0xAD), unchecked (( sbyte )0xB0), ( sbyte )0x17, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); // THEN Exception.expect(typeof(IOException)); Connection.recv(4); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void testFailureWithV2Value(org.neo4j.values.AnyValue value, String description) throws Exception private void TestFailureWithV2Value(AnyValue value, string description) { _connection.connect(_address).send(_util.defaultAcceptedVersions()); assertThat(_connection, _util.eventuallyReceivesSelectedProtocolVersion()); _connection.send(_util.chunk(new InitMessage(USER_AGENT, Collections.emptyMap()))); assertThat(_connection, _util.eventuallyReceives(msgSuccess())); _connection.send(_util.chunk(64, CreateRunWithV2Value(value))); assertThat(_connection, _util.eventuallyReceives(msgFailure(Org.Neo4j.Kernel.Api.Exceptions.Status_Statement.TypeError, description + " values cannot be unpacked with this version of bolt."))); assertThat(_connection, eventuallyDisconnects()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNegotiateProtocolV2() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNegotiateProtocolV2() { _connection.connect(_address).send(_util.acceptedVersions(2, 0, 0, 0)).send(_util.chunk(new InitMessage(USER_AGENT, emptyMap()))); assertThat(_connection, eventuallyReceives(new sbyte[] { 0, 0, 0, 2 })); }