Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -63,7 +63,7 @@ namespace MonoTests.System.Net.Sockets
clientSocket.NoDelay = true;
Assert.IsTrue(mainEvent.WaitOne(1500));
Assert.AreEqual(serverSocket, acceptedSocket);
Assert.AreEqual(serverSocket, acceptedSocket, "x");
mainEvent.Reset();
if (acceptedSocket != null)

View File

@@ -1 +1 @@
14ec2700869c289ee1159851c5402e07138b70a5
5473cf3916b998b25e4b8dcf2f55fb2b14a3f1e0

View File

@@ -199,5 +199,16 @@ namespace MonoTests.System.Net.Sockets
Assert.Fail ("ConnectMultiRefused #3");
}
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ExclusiveAddressUse ()
{
using (TcpClient client = new TcpClient ()) {
client.ExclusiveAddressUse = false;
}
}
}
}

View File

@@ -219,5 +219,27 @@ namespace MonoTests.System.Net.Sockets
listen.Start (65536);
listen.Stop ();
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void EndAcceptTcpClient ()
{
var port = NetworkHelpers.FindFreePort ();
var listenerSocket = new TcpListener (IPAddress.Any, port);
listenerSocket.Start ();
listenerSocket.BeginAcceptTcpClient (new AsyncCallback (l => {
listenerSocket.EndAcceptTcpClient (l);
}), null);
using (var outClient = new TcpClient ("localhost", port)) {
using (var stream = outClient.GetStream ()) {
stream.WriteByte (3);
}
}
}
}
}

View File

@@ -558,25 +558,15 @@ namespace MonoTests.System.Net.Sockets {
}
[Test] // JoinMulticastGroup (IPAddress)
[Category ("NotWorking")]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void JoinMulticastGroup1_Socket_NotBound ()
{
IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
UdpClient client = new UdpClient (AddressFamily.InterNetwork);
try {
using (UdpClient client = new UdpClient (AddressFamily.InterNetwork)) {
client.JoinMulticastGroup (mcast_addr);
Assert.Fail ("#1");
} catch (SocketException ex) {
// An invalid argument was supplied
Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
Assert.AreEqual (10022, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
} finally {
client.Close ();
}
}
@@ -666,25 +656,15 @@ namespace MonoTests.System.Net.Sockets {
}
[Test] // JoinMulticastGroup (Int32, IPAddress)
[Category ("NotWorking")]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void JoinMulticastGroup2_Socket_NotBound ()
{
IPAddress mcast_addr = IPAddress.Parse ("ff02::1");
UdpClient client = new UdpClient (AddressFamily.InterNetworkV6);
try {
using (UdpClient client = new UdpClient (AddressFamily.InterNetworkV6)) {
client.JoinMulticastGroup (0, mcast_addr);
Assert.Fail ("#1");
} catch (SocketException ex) {
// An invalid argument was supplied
Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
Assert.AreEqual (10022, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
} finally {
client.Close ();
}
}
@@ -767,25 +747,15 @@ namespace MonoTests.System.Net.Sockets {
}
[Test] // JoinMulticastGroup (IPAddress, Int32)
[Category ("NotWorking")]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void JoinMulticastGroup3_Socket_NotBound ()
{
IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
UdpClient client = new UdpClient (AddressFamily.InterNetwork);
try {
using (UdpClient client = new UdpClient (AddressFamily.InterNetwork)) {
client.JoinMulticastGroup (mcast_addr, 5);
Assert.Fail ("#1");
} catch (SocketException ex) {
// An invalid argument was supplied
Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
Assert.AreEqual (10022, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
} finally {
client.Close ();
}
}
@@ -896,26 +866,16 @@ namespace MonoTests.System.Net.Sockets {
}
[Test] // JoinMulticastGroup (IPAddress, IPAddress)
[Category ("NotWorking")]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void JoinMulticastGroup4_Socket_NotBound ()
{
IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
IPAddress local_addr = Dns.GetHostEntry (string.Empty).AddressList [0];
UdpClient client = new UdpClient (AddressFamily.InterNetwork);
try {
using (UdpClient client = new UdpClient (AddressFamily.InterNetwork)) {
client.JoinMulticastGroup (mcast_addr, local_addr);
Assert.Fail ("#1");
} catch (SocketException ex) {
// An invalid argument was supplied
Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
Assert.AreEqual (10022, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
} finally {
client.Close ();
}
}
@@ -1031,8 +991,14 @@ namespace MonoTests.System.Net.Sockets {
"BeginSend #4");
}
IPEndPoint ep = new IPEndPoint (Dns.GetHostEntry (string.Empty).AddressList[0], 1236);
IPAddress[] addresses = Dns.GetHostEntry (string.Empty).AddressList;
IPEndPoint ep = null;
foreach (IPAddress a in addresses) {
if (a.AddressFamily == AddressFamily.InterNetwork) {
ep = new IPEndPoint (a, 1236);
break;
}
}
BSCalledBack.Reset ();
client.BeginSend (bytes, bytes.Length, ep,