//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());
        }
예제 #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 ")))));
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldUseConfiguredCertificate() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldUseConfiguredCertificate()
        {
            // GIVEN
            SecureSocketConnection connection = new SecureSocketConnection();

            try
            {
                // WHEN
                connection.Connect(Server.lookupConnector(DEFAULT_CONNECTOR_KEY)).send(_util.acceptedVersions(1, 0, 0, 0));

                // THEN
                ISet <X509Certificate> certificatesSeen = connection.ServerCertificatesSeen;
                assertThat(certificatesSeen, contains(LoadCertificateFromDisk()));
            }
            finally
            {
                connection.Disconnect();
            }
        }