System.Net.Tests.ServicePointManagerTest.FindServicePoint_NewServicePointsInheritCurrentValues C# (CSharp) Method

FindServicePoint_NewServicePointsInheritCurrentValues() private method

        public static void FindServicePoint_NewServicePointsInheritCurrentValues()
        {
            string address1 = "http://" + Guid.NewGuid().ToString("N");
            string address2 = "http://" + Guid.NewGuid().ToString("N");

            bool orig100Continue = ServicePointManager.Expect100Continue;
            bool origNagle = ServicePointManager.UseNagleAlgorithm;

            ServicePointManager.Expect100Continue = false;
            ServicePointManager.UseNagleAlgorithm = false;
            ServicePoint sp1 = ServicePointManager.FindServicePoint(address1, null);
            Assert.False(sp1.Expect100Continue);
            Assert.False(sp1.UseNagleAlgorithm);

            ServicePointManager.Expect100Continue = true;
            ServicePointManager.UseNagleAlgorithm = true;
            ServicePoint sp2 = ServicePointManager.FindServicePoint(address2, null);
            Assert.True(sp2.Expect100Continue);
            Assert.True(sp2.UseNagleAlgorithm);
            Assert.False(sp1.Expect100Continue);
            Assert.False(sp1.UseNagleAlgorithm);

            ServicePointManager.Expect100Continue = orig100Continue;
            ServicePointManager.UseNagleAlgorithm = origNagle;
        }