}
[Fact]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/55053", TestPlatforms.Linux)]
public async Task Connect_DualMode_MultiAddressFamilyConnect_RetrievedEndPoints_Success()
{
if (!SupportsMultiConnect)
{
Assert.True(client.DualMode);
- Task connectTask = MultiConnectAsync(client, new IPAddress[] { IPAddress.IPv6Loopback, IPAddress.Loopback }, port);
- await connectTask;
-
- var localEndPoint = client.LocalEndPoint as IPEndPoint;
- Assert.NotNull(localEndPoint);
- Assert.Equal(IPAddress.Loopback.MapToIPv6(), localEndPoint.Address);
+ await MultiConnectAsync(client, new IPAddress[] { IPAddress.IPv6Loopback, IPAddress.Loopback }, port);
- var remoteEndPoint = client.RemoteEndPoint as IPEndPoint;
- Assert.NotNull(remoteEndPoint);
- Assert.Equal(IPAddress.Loopback.MapToIPv6(), remoteEndPoint.Address);
+ CheckIsIpv6LoopbackEndPoint(client.LocalEndPoint);
+ CheckIsIpv6LoopbackEndPoint(client.RemoteEndPoint);
}
}
[Fact]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/54677", TestPlatforms.Linux)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55709", TestPlatforms.Linux)]
public async Task Connect_DualMode_DnsConnect_RetrievedEndPoints_Success()
{
{
Assert.True(client.DualMode);
- Task connectTask = ConnectAsync(client, new DnsEndPoint("localhost", port));
- await connectTask;
-
- var localEndPoint = client.LocalEndPoint as IPEndPoint;
- Assert.NotNull(localEndPoint);
- Assert.True(localEndPoint.Address.Equals(IPAddress.IPv6Loopback) || localEndPoint.Address.Equals(IPAddress.Loopback.MapToIPv6()));
+ await ConnectAsync(client, new DnsEndPoint("localhost", port));
- var remoteEndPoint = client.RemoteEndPoint as IPEndPoint;
- Assert.NotNull(remoteEndPoint);
- Assert.Equal(IPAddress.Loopback.MapToIPv6(), remoteEndPoint.Address);
+ CheckIsIpv6LoopbackEndPoint(client.LocalEndPoint);
+ CheckIsIpv6LoopbackEndPoint(client.RemoteEndPoint);
}
}
+ private static void CheckIsIpv6LoopbackEndPoint(EndPoint endPoint)
+ {
+ IPEndPoint ep = endPoint as IPEndPoint;
+ Assert.NotNull(ep);
+ Assert.True(ep.Address.Equals(IPAddress.IPv6Loopback) || ep.Address.Equals(IPAddress.Loopback.MapToIPv6()));
+ }
+
[Fact]
public async Task Connect_OnConnectedSocket_Fails()
{