private bool IsInternetAvailable()
{
try
{
//This change has been done for the purpose of testing the S3 Xamarin Proxy.
//These proxy settings on the TestRunner will not be shipped.
var clientHandler = new System.Net.Http.HttpClientHandler
{
UseProxy = true,
Proxy = new WebProxy("http://localhost:8888/")
};
clientHandler.Proxy.Credentials = new NetworkCredential("1", "1");
var client = new HttpClient(clientHandler);
var content = client.GetStringAsync(internetTestAddress).Result;
if (string.IsNullOrEmpty(content))
{
WriteError("Accessing {0} returned an empty body");
return false;
}
return true;
}
catch(Exception e)
{
WriteError("Error accessing {0}: {1}", e);
return false;
}
}