static Uri NormalizeEndpoint(Uri endpoint) { return(ServiceEndPoint.IsWebSocketAddress(endpoint) ? new Uri(endpoint.AbsoluteUri.ToLowerInvariant()) : new Uri(endpoint.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped).TrimEnd('/').ToLowerInvariant())); }