public static Proxy proxyFor(ProxySelector proxySelector, URL u)throws ConnectException {try {URI uri = new URI(u.getProtocol(), null, u.getHost(), u.getPort(),null, null, null);return proxySelector.select(uri).get(0);} catch (URISyntaxException e) {final ConnectException err;err = new ConnectException(MessageFormat.format(JGitText.get().cannotDetermineProxyFor, u));err.initCause(e);throw err;}}

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;}}
