private T RequestAndDeserialize <T>(string path, Func <string, T> deserializer, NameValueCollection postData, TimeSpan timeout)
        {
            var eventArgs = new ClientRequestEventArgs(path, postData);

            OnBeforeClientRequest(eventArgs);
            try
            {
                string response = Request(path, postData, timeout);
                return(deserializer(response));
            }
            finally
            {
                OnAfterClientRequest(eventArgs);
            }
        }
 protected virtual void OnAfterClientRequest(ClientRequestEventArgs args)
 {
     AfterClientRequest?.Invoke(this, args);
 }
 protected virtual void OnBeforeClientRequest(ClientRequestEventArgs args)
 {
     BeforeClientRequest?.Invoke(this, args);
 }