public WebProxy GetProxySettings() { var proxyHost = JavaSystem.GetProperty("http.proxyHost"); var proxyPort = JavaSystem.GetProperty("http.proxyPort"); return(!string.IsNullOrEmpty(proxyHost) && !string.IsNullOrEmpty(proxyPort) ? new WebProxy($"{proxyHost}:{proxyPort}") : null); }
public WebProxy GetWebProxy() { string proxyHost = JavaSystem.GetProperty("http.proxyHost"); string proxyPortString = JavaSystem.GetProperty("http.proxyPort"); if (!string.IsNullOrWhiteSpace(proxyHost) && !string.IsNullOrWhiteSpace(proxyPortString) && int.TryParse(proxyPortString, out int proxyPort) && proxyPort != 0) { return(new WebProxy(proxyHost, proxyPort)); } return(null); }
public WebProxy GetProxySettings() { var proxyHost = JavaSystem.GetProperty("http.proxyHost"); var proxyPort = JavaSystem.GetProperty("http.proxyPort"); //setting this for local android(emulator) instance //var proxyHost = "10.0.2.2"; //var proxyPort = "3130"; Console.WriteLine("Proxy host is: " + proxyHost); Console.WriteLine("Proxy port is: " + proxyPort); return(!string.IsNullOrEmpty(proxyHost) && !string.IsNullOrEmpty(proxyPort) ? new WebProxy($"{proxyHost}:{proxyPort}") : null); }
public Task <WebProxy> CreateProxyAsync(Uri destination) { // if a proxy is enabled set it up here string host = JavaSystem.GetProperty("http.proxyHost")?.TrimEnd('/'); string port = JavaSystem.GetProperty("http.proxyPort"); if (host == null) { return(Task.FromResult <WebProxy>(null)); } //proxy auth //ICredentials credentials = new NetworkCredential("username", "password"); //WebProxy proxy = new WebProxy(new Uri(host+':'+port), true, null, credentials); return(Task.FromResult(new WebProxy(host, Int32.Parse(port)))); }