コード例 #1
0
 private void Close(TransportConnection connection)
 {
     if (connection != null)
     {
         try
         {
             connection.Disconnect();
         }
         catch (IOException)
         {
         }
     }
 }
コード例 #2
0
        private FailureMessage CollectAuthFailureOnFailedAuth()
        {
            FailureMsgMatcher failureRecorder = new FailureMsgMatcher(this);

            TransportConnection connection = null;

            try
            {
                connection = NewConnection();

                connection.Connect(_address).send(Util.defaultAcceptedVersions()).send(Util.chunk(new InitMessage("TestClient/1.1", map("principal", "neo4j", "credentials", "WHAT_WAS_THE_PASSWORD_AGAIN", "scheme", "basic"))));

                assertThat(connection, Util.eventuallyReceivesSelectedProtocolVersion());
                assertThat(connection, Util.eventuallyReceives(failureRecorder));
                assertThat(connection, eventuallyDisconnects());
            }
            catch (Exception ex)
            {
                throw new Exception(ex);
            }
            finally
            {
                if (connection != null)
                {
                    try
                    {
                        connection.Disconnect();
                    }
                    catch (IOException ex)
                    {
                        throw new Exception(ex);
                    }
                }
            }

            return(failureRecorder.SpecialMessage);
        }