diff --git a/tests/BCL-Tests/LocalTests.NUnit/System.Net.Http/HttpClientTest.cs b/tests/BCL-Tests/LocalTests.NUnit/System.Net.Http/HttpClientTest.cs index b82b12286d1..c86f317ec61 100644 --- a/tests/BCL-Tests/LocalTests.NUnit/System.Net.Http/HttpClientTest.cs +++ b/tests/BCL-Tests/LocalTests.NUnit/System.Net.Http/HttpClientTest.cs @@ -1,6 +1,7 @@ using System; using System.Net; using System.Net.Http; +using System.Threading.Tasks; using NUnit.Framework; @@ -19,12 +20,15 @@ public void TestUnescapedURI () var t = client.GetStringAsync("http://naver.com/t[e]st.txt"); t.Wait(1000); Assert.IsNotNull(t.Result); - } - catch (AggregateException e) - { + } catch (TaskCanceledException) { + Assert.Ignore ("Connection timed out"); + } catch (AggregateException e) { Assert.AreEqual (1, e.InnerExceptions.Count); - Assert.AreEqual (typeof(HttpRequestException), e.InnerExceptions[0].GetType ()); + if (e.InnerExceptions[0].GetType () == typeof (TaskCanceledException)) + Assert.Ignore ("Connection timed out"); + else + Assert.AreEqual (typeof(HttpRequestException), e.InnerExceptions[0].GetType ()); } } } -} \ No newline at end of file +}