Esempio n. 1
0
        public static void testRequest()
        {
            Request request = new Request();

            request.IsHttps = true;
            request.Method  = "GET";
            request.Url     = "https://cloud.tencent.com/";



            HttpClientConfig config = new HttpClientConfig.Builder()
                                      .AllowAutoRedirect(true)
                                      .SetConnectionLimit(100)
                                      .SetConnectionTimeoutMs(45000)
                                      .SetReadWriteTimeoutMs(45000)
                                      .SetMaxRetry(3)
                                      //.SetProxyHost("web-proxy.tencent.com")
                                      .SetProxyPort(8080)
                                      .Build();

            CommandTask.Init(config);

            Response response = new Response();

            response.Body = null;

            CommandTask.excute(request, response, config);


            Console.WriteLine(response.Code + "|" + response.Message);
            foreach (KeyValuePair <string, List <string> > pair in response.Headers)
            {
                Console.WriteLine(pair.Key + " : " + pair.Value[0]);
            }
        }