コード例 #1
0
        public HttpBackend CreateInstance(TestContext ctx)
        {
            var endpoint = ConnectionTestHelper.GetEndPoint(ctx);

            ConnectionParameters parameters;
            ISslStreamProvider   sslStreamProvider = null;

            var flags = GetHttpFlags(ctx);

            if (GetParameters(ctx, out parameters))
            {
                sslStreamProvider = GetSslStreamProvider(ctx);
            }

            HttpBackend backend;

            if ((flags & HttpFlags.HttpListener) != 0)
            {
                backend = new HttpListenerBackend(endpoint, endpoint, flags, parameters, sslStreamProvider);
            }
            else
            {
                backend = new BuiltinHttpBackend(endpoint, endpoint, flags, parameters, sslStreamProvider);
            }
            return(backend);
        }
コード例 #2
0
        public virtual HttpServer CreateInstance(TestContext ctx)
        {
            var endpoint = ConnectionTestHelper.GetEndPoint(ctx);

            ConnectionParameters parameters;
            ISslStreamProvider   sslStreamProvider = null;

            var flags = GetListenerFlags(ctx);

            if (GetParameters(ctx, out parameters))
            {
                sslStreamProvider = GetSslStreamProvider(ctx);
            }

            return(new HttpServer(endpoint, endpoint, flags, parameters, sslStreamProvider));
        }
コード例 #3
0
        public HttpsTestRunner CreateInstance(TestContext ctx)
        {
            var provider = ctx.GetParameter <ConnectionTestProvider> ();

            var parameters = ctx.GetParameter <HttpsTestParameters> ();

            ProtocolVersions protocolVersion;

            if (ctx.TryGetParameter <ProtocolVersions> (out protocolVersion))
            {
                parameters.ProtocolVersion = protocolVersion;
            }

            IPortableEndPoint serverEndPoint;

            if (parameters.ListenAddress != null)
            {
                serverEndPoint = parameters.ListenAddress;
            }
            else if (parameters.EndPoint != null)
            {
                serverEndPoint = parameters.EndPoint;
            }
            else
            {
                serverEndPoint = ConnectionTestHelper.GetEndPoint(ctx);
            }

            if (parameters.EndPoint == null)
            {
                parameters.EndPoint = serverEndPoint;
            }
            if (parameters.ListenAddress == null)
            {
                parameters.ListenAddress = serverEndPoint;
            }

            var flags = serverFlags | HttpServerFlags.SSL;

            bool reuseConnection;

            if (ctx.TryGetParameter <bool> (out reuseConnection, "ReuseConnection") && reuseConnection)
            {
                flags |= HttpServerFlags.ReuseConnection;
            }

            Uri uri;

            if (parameters.ExternalServer != null)
            {
                uri    = parameters.ExternalServer;
                flags |= HttpServerFlags.ExternalServer;
            }
            else if (parameters.TargetHost == null)
            {
                parameters.TargetHost = parameters.EndPoint.HostName;
                uri = new Uri(string.Format("https://{0}:{1}/", parameters.EndPoint.Address, parameters.EndPoint.Port));
            }
            else
            {
                uri = new Uri(string.Format("https://{0}/", parameters.TargetHost));
            }

            return(new HttpsTestRunner(parameters.EndPoint, parameters, provider, uri, flags));
        }
コード例 #4
0
 public SslStreamTestRunner CreateInstance(TestContext ctx)
 {
     return(ConnectionTestHelper.CreateTestRunner <ConnectionTestProvider, SslStreamTestParameters, SslStreamTestRunner> (
                ctx, (s, c, t, p) => new SslStreamTestRunner(s, c, t, p)));
 }