Beispiel #1
0
 public void Responds_to_unsupported_authentication_method_with_failure()
 {
     using (var stream = new LoopbackTcpStream(5, 1, 254))
         using (var connection = new SocksConnection(
                    stream,
                    new FakeProxyFactory(),
                    ArrayPool <byte> .Shared,
                    new NullLoggerFactory()))
         {
             connection.StartHandlingClient();
             stream.WaitForWrittenBytes(2).Should().Equal(5, 255);
         }
 }
Beispiel #2
0
 public void Responds_to_invalid_address_type_with_failure()
 {
     using (var stream = new LoopbackTcpStream(
                5,
                1,
                0,
                5,
                (byte)CommandType.Connect,
                0,
                254,
                1,
                2,
                3,
                4,
                0,
                255))
         using (var connection = new SocksConnection(
                    stream,
                    new FakeProxyFactory(),
                    ArrayPool <byte> .Shared,
                    new NullLoggerFactory()))
         {
             connection.StartHandlingClient();
             stream.WaitForWrittenBytes(2).Should().Equal(5, 0);
             stream.WaitForWrittenBytes(10).Should().Equal(
                 5,
                 (byte)CommandReplyType.AddressTypeNotSupported,
                 0,
                 1,
                 0,
                 0,
                 0,
                 0,
                 0,
                 0);
         }
 }
Beispiel #3
0
        public void Assumes_ownership_of_stream_and_disposes_it()
        {
            var stream = new LoopbackTcpStream(5, 1, 254);

            using (var connection = new SocksConnection(
                       stream,
                       new FakeProxyFactory(),
                       ArrayPool <byte> .Shared,
                       new NullLoggerFactory()))
            {
                connection.StartHandlingClient();
                stream.WaitForWrittenBytes(2).Should().Equal(5, 255);
            }

            stream.IsDisposed.Should().BeTrue();
        }