Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertEventuallyServerResponds(String host, int port) throws Exception
        private void AssertEventuallyServerResponds(string host, int port)
        {
            SecureSocketConnection conn = new SecureSocketConnection();

            conn.Connect(new HostnamePort(host, port));
            conn.Send(new sbyte[] { ( sbyte )0x60, ( sbyte )0x60, unchecked (( sbyte )0xB0), ( sbyte )0x17, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
            assertThat(conn.Recv(4), equalTo(new sbyte[] { 0, 0, 0, 1 }));
        }
Пример #2
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();
            }
        }