Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@ -35,12 +35,13 @@ namespace MonoTests.System.Net.Sockets
Socket lSock = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
lSock.Bind(new IPEndPoint(IPAddress.Any, 8765));
var port = NetworkHelpers.FindFreePort ();
lSock.Bind(new IPEndPoint(IPAddress.Any, port));
lSock.Listen(-1);
// connect to it with a TcpClient
TcpClient outClient = new TcpClient("localhost", 8765);
TcpClient outClient = new TcpClient("localhost", port);
Socket inSock = lSock.Accept();
@ -77,9 +78,10 @@ namespace MonoTests.System.Net.Sockets
[Test] // bug #81105
public void CloseTest ()
{
IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8765);
var port = NetworkHelpers.FindFreePort ();
IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, port);
using (SocketResponder sr = new SocketResponder (localEP, s => CloseRequestHandler (s))) {
TcpClient tcpClient = new TcpClient (IPAddress.Loopback.ToString (), 8765);
TcpClient tcpClient = new TcpClient (IPAddress.Loopback.ToString (), port);
NetworkStream ns = tcpClient.GetStream ();
Assert.IsNotNull (ns, "#A1");
Assert.AreEqual (0, tcpClient.Available, "#A2");
@ -104,7 +106,7 @@ namespace MonoTests.System.Net.Sockets
}
using (SocketResponder sr = new SocketResponder (localEP, s => CloseRequestHandler (s))) {
TcpClient tcpClient = new TcpClient (IPAddress.Loopback.ToString (), 8765);
TcpClient tcpClient = new TcpClient (IPAddress.Loopback.ToString (), port);
Assert.AreEqual (0, tcpClient.Available, "#B1");
Assert.IsTrue (tcpClient.Connected, "#B2");
// Assert.IsFalse (tcpClient.ExclusiveAddressUse, "#B3");