public void Init()
        {
            var option = new DotNettyClientOptions()
            {
                Proxy = new WebProxy(TestServerConstant.TestHost, TestServerConstant.ProxyPort)
            };
            var handler = new HttpDotNettyClientHandler(option);

            _httpClient = new HttpClient(handler);
        }
Exemplo n.º 2
0
        public void Init()
        {
            var option = new DotNettyClientOptions()
            {
                RemoteCertificateValidationCallback = (s, s1, s2, s3) => TestServerConstant.CertThumbprint.Equals(s2.ChainElements[0].Certificate.Thumbprint, StringComparison.OrdinalIgnoreCase),
            };
            var handler = new HttpDotNettyClientHandler(option);

            _httpClient = new HttpClient(handler);
        }
        public virtual void Init()
        {
            var option = new DotNettyClientOptions()
            {
                ConnectionLimit        = ConnectionLimit,
                Proxy                  = new WebProxy(TestServerConstant.TestHost, TestServerConstant.ProxyPort),
                ResourcesTimeout       = TimeSpan.FromSeconds(TimecouSeconds),
                ResourcesCheckInterval = TimeSpan.FromDays(1),
            };

            _executor = new DotNettyHttpRequestExecutor(option);
        }
Exemplo n.º 4
0
        public void Init()
        {
            var option = new DotNettyClientOptions()
            {
                Proxy = new WebProxy(TestServerConstant.TestHost, TestServerConstant.AuthProxyPort)
                {
                    Credentials = new NetworkCredential(TestServerConstant.ProxyUserName, TestServerConstant.ProxyPassword)
                }
            };
            var handler = new HttpDotNettyClientHandler(option);

            _httpClient = new HttpClient(handler);
        }
Exemplo n.º 5
0
        public void Init()
        {
            var option = new DotNettyClientOptions()
            {
                RemoteCertificateValidationCallback = (s, s1, s2, s3) => TestServerConstant.CertThumbprint.Equals(s2.ChainElements[0].Certificate.Thumbprint, StringComparison.OrdinalIgnoreCase),
                Proxy = new WebProxy(TestServerConstant.TestHost, TestServerConstant.AuthProxyPort)
                {
                    Credentials = new NetworkCredential(TestServerConstant.ProxyUserName, TestServerConstant.ProxyPassword)
                }
            };
            var handler = new HttpDotNettyClientHandler(option);

            _httpClient = new HttpClient(handler);
        }
        public async Task MultiHttpDotNettyClientHandler()
        {
            var option = new DotNettyClientOptions()
            {
                ConnectionLimit = 25,
            };

            var client = new HttpClient(new HttpDotNettyClientHandler(option));

            var tasks = Enumerable.Range(0, RequestCount).Select(async m =>
            {
                var html = await client.GetStringAsync(Url).ConfigureAwait(false);
            });

            await Task.WhenAll(tasks).ConfigureAwait(false);
        }