private void PrintServicePointConnections(ServicePoint sp) {
     var spType = sp.GetType();
     var privateOrPublicInstanceField = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
     var connectionGroupField = spType.GetField("m_ConnectionGroupList",privateOrPublicInstanceField);
     var value = (Hashtable)connectionGroupField.GetValue(sp);
     var connectionGroups = value.Keys.Cast<object>().ToList();
     var totalConnections = 0;
     Output("ServicePoint: {0} (Connection Limit: {1}, Reported connections: {2})", sp.Address,sp.ConnectionLimit,sp.CurrentConnections);
     foreach(var key in connectionGroups) {
         var connectionGroup = value[key];
         var groupType = connectionGroup.GetType();
         var listField = groupType.GetField("m_ConnectionList",privateOrPublicInstanceField);
         var listValue = (ArrayList)listField.GetValue(connectionGroup);
         //Console.WriteLine("{3} {0}\nConnectionGroup: {1} Count: {2}",sp.Address, key,listValue.Count, DateTime.Now);
         Output("{0}", key);
         totalConnections+=listValue.Count;
     }
     
     Output("ConnectionGroupCount: {0}, Total Connections: {1}", connectionGroups.Count, totalConnections);
 }
        private ServicePointStatusServicePoint PrintServicePointConnections(ServicePoint sp)
        {
            var spType = sp.GetType();
            var privateOrPublicInstanceField = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
            var connectionGroupField = spType.GetField("m_ConnectionGroupList", privateOrPublicInstanceField);
            var value = (Hashtable)connectionGroupField.GetValue(sp);
            var connectionGroups = value.Keys.Cast<object>().ToList();

            var servicePointStatus = new ServicePointStatusServicePoint
                                     {
                                         Address = sp.Address,
                                         ConnectionLimit = sp.ConnectionLimit,
                                         CurrentConnection = sp.CurrentConnections,
                                         ConnectionGroupCount = connectionGroups.Count,
                                         TotalConnections = 0
                                     };

            foreach (var key in connectionGroups)
            {
                var connectionGroup = value[key];
                var groupType = connectionGroup.GetType();
                var listField = groupType.GetField("m_ConnectionList", privateOrPublicInstanceField);
                var listValue = (ArrayList)listField.GetValue(connectionGroup);
                //Console.WriteLine("{3} {0}\nConnectionGroup: {1} Count: {2}",sp.Address, key,listValue.Count, DateTime.Now);

                servicePointStatus.ConnectionGroups.Add(new ServicePointStatusConnectionGroup
                                                        {
                                                            Key = key,
                                                            Count = listValue.Count
                                                        });

                servicePointStatus.TotalConnections += listValue.Count;
            }

            return servicePointStatus;
        }