/// <summary>Determine the proxy server (if any) needed to obtain a URL.</summary> /// <remarks>Determine the proxy server (if any) needed to obtain a URL.</remarks> /// <param name="proxySelector">proxy support for the caller.</param> /// <param name="u">location of the server caller wants to talk to.</param> /// <returns>proxy to communicate with the supplied URL.</returns> /// <exception cref="Sharpen.ConnectException"> /// the proxy could not be computed as the supplied URL could not /// be read. This failure should never occur. /// </exception> public static Proxy ProxyFor(ProxySelector proxySelector, Uri u) { try { return proxySelector.Select(u.ToURI())[0]; } catch (URISyntaxException e) { ConnectException err; err = new ConnectException(MessageFormat.Format(JGitText.Get().cannotDetermineProxyFor , u)); Sharpen.Extensions.InitCause(err, e); throw err; } }