//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());
        }
Example #2
0
//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 ")))));
        }