[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue(11057)]
public async Task GetAsync_InvalidUrl_ExpectedExceptionThrown()
{
- string invalidUri = $"http://_{Guid.NewGuid().ToString("N")}";
+ string invalidUri = $"http://{Configuration.Sockets.InvalidHost}";
_output.WriteLine($"{DateTime.Now} connecting to {invalidUri}");
using (HttpClient client = CreateHttpClient())
{
namespace System.Net.Sockets.Tests
{
+ using Configuration = System.Net.Test.Common.Configuration;
+
public class DnsEndPointTest : DualModeBase
{
private void OnConnectAsyncCompleted(object sender, SocketAsyncEventArgs args)
{
SocketException ex = Assert.ThrowsAny<SocketException>(() =>
{
- sock.Connect(new DnsEndPoint("notahostname.invalid.corp.microsoft.com", UnusedPort));
+ sock.Connect(new DnsEndPoint(Configuration.Sockets.InvalidHost, UnusedPort));
});
SocketError errorCode = ex.SocketErrorCode;
{
SocketException ex = Assert.ThrowsAny<SocketException>(() =>
{
- IAsyncResult result = sock.BeginConnect(new DnsEndPoint("notahostname.invalid.corp.microsoft.com", UnusedPort), null, null);
+ IAsyncResult result = sock.BeginConnect(new DnsEndPoint(Configuration.Sockets.InvalidHost, UnusedPort), null, null);
sock.EndConnect(result);
});
Assert.True(Capability.IPv4Support());
SocketAsyncEventArgs args = new SocketAsyncEventArgs();
- args.RemoteEndPoint = new DnsEndPoint("notahostname.invalid.corp.microsoft.com", UnusedPort);
+ args.RemoteEndPoint = new DnsEndPoint(Configuration.Sockets.InvalidHost, UnusedPort);
args.Completed += OnConnectAsyncCompleted;
using (Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
public void Socket_StaticConnectAsync_HostNotFound()
{
SocketAsyncEventArgs args = new SocketAsyncEventArgs();
- args.RemoteEndPoint = new DnsEndPoint("notahostname.invalid.corp.microsoft.com", UnusedPort);
+ args.RemoteEndPoint = new DnsEndPoint(Configuration.Sockets.InvalidHost, UnusedPort);
args.Completed += OnConnectAsyncCompleted;
ManualResetEvent complete = new ManualResetEvent(false);