You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
@ -874,8 +874,14 @@ namespace MonoTests.System.Net {
|
||||
|
||||
int port = NetworkHelpers.FindFreePort ();;
|
||||
var h = new HttpListener ();
|
||||
h.Prefixes.Add ("http://" + machineAddress [0] + ":" + port + "/");
|
||||
h.Start ();
|
||||
// Listen on the first IPV4 interface
|
||||
foreach (IPAddress a in machineAddress) {
|
||||
if (a.AddressFamily == AddressFamily.InterNetwork) {
|
||||
h.Prefixes.Add ("http://" + a + ":" + port + "/");
|
||||
h.Start ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var c = new TcpClient ("localhost", port);
|
||||
|
@ -34,6 +34,7 @@ using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
@ -211,6 +212,8 @@ namespace MonoTests.System.Net
|
||||
var ips = new List<IPAddress> ();
|
||||
ips.Add (IPAddress.Loopback);
|
||||
foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces ()) {
|
||||
if (adapter.OperationalStatus != OperationalStatus.Up)
|
||||
continue;
|
||||
foreach (var ip in adapter.GetIPProperties ().UnicastAddresses) {
|
||||
ips.Add (ip.Address);
|
||||
}
|
||||
@ -252,12 +255,38 @@ namespace MonoTests.System.Net
|
||||
var request = (HttpWebRequest) WebRequest.Create (rawUrl);
|
||||
request.GetResponseAsync ();
|
||||
|
||||
if(!contextTask.Wait (1000))
|
||||
Assert.Fail ("Timeout");
|
||||
Assert.IsTrue (contextTask.Wait (1000));
|
||||
|
||||
Assert.AreEqual (expectedUrl, contextTask.Result.Request.Url.AbsoluteUri);
|
||||
|
||||
listener.Close ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
public void EmptyWrite ()
|
||||
{
|
||||
var prefix = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
|
||||
|
||||
HttpListener listener = new HttpListener ();
|
||||
listener.Prefixes.Add (prefix);
|
||||
listener.Start ();
|
||||
|
||||
Task.Run (() => {
|
||||
var context = listener.GetContext ();
|
||||
|
||||
var s = context.Response.OutputStream;
|
||||
s.Write (new byte[10], 0, 0);
|
||||
return;
|
||||
});
|
||||
|
||||
var request = (HttpWebRequest)WebRequest.Create (prefix);
|
||||
var rsp = request.GetResponseAsync ();
|
||||
Assert.IsFalse (rsp.Wait (1000), "Don't send on empty write");
|
||||
|
||||
listener.Close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -438,6 +438,17 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OpenReadTaskAsyncOnFile ()
|
||||
{
|
||||
var tmp = Path.GetTempFileName ();
|
||||
string url = "file://" + tmp;
|
||||
|
||||
var client = new WebClient ();
|
||||
var task = client.OpenReadTaskAsync (url);
|
||||
Assert.IsTrue (task.Wait (2000));
|
||||
}
|
||||
|
||||
[Test] // OpenWrite (string)
|
||||
public void OpenWrite1_Address_Null ()
|
||||
{
|
||||
|
Reference in New Issue
Block a user