[TestFixture]
public class HttpWebRequestTest
{
-#if NET_2_0
private Random rand = new Random ();
private byte [] data64KB = new byte [64 * 1024];
ServicePointManager.Expect100Continue = false;
rand.NextBytes (data64KB);
}
-#endif
[Test]
#if TARGET_JVM
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
Assert.IsNotNull (req.Proxy, "#1");
-#if NET_2_0
req.Proxy = null;
Assert.IsNull (req.Proxy, "#2");
-#else
- try {
- req.Proxy = null;
- Assert.Fail ("#2");
- } catch (ArgumentNullException ex) {
- Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#3");
- Assert.IsNull (ex.InnerException, "#4");
- Assert.IsNotNull (ex.Message, "#5");
- Assert.IsNotNull (ex.ParamName, "#6");
- Assert.AreEqual ("value", ex.ParamName, "#7");
- }
-#endif
}
[Test]
[Test] // bug #471782
public void CloseRequestStreamAfterReadingResponse ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9152);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
#if !TARGET_JVM //NotWorking
[Test]
+ [Ignore ("Fails on MS.NET")]
public void SslClientBlock ()
{
// This tests that the write request/initread/write body sequence does not hang
public void MethodCase ()
{
ListDictionary methods = new ListDictionary ();
-#if NET_2_0
methods.Add ("post", "POST");
methods.Add ("puT", "PUT");
-#else
- methods.Add ("post", "post");
- methods.Add ("puT", "puT");
-#endif
methods.Add ("POST", "POST");
methods.Add ("whatever", "whatever");
methods.Add ("PUT", "PUT");
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9153);
string url = "http://" + ep.ToString () + "/test/";
foreach (DictionaryEntry de in methods) {
[Test]
public void BeginGetRequestStream_Body_NotAllowed ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9154);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
[Test] // bug #465613
public void BeginGetRequestStream_NoBuffering ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8002);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 11001);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
}
[Test] // bug #508027
+ [Category ("NotWorking")] // #5842
public void BeginGetResponse ()
{
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8001);
HttpWebRequest req;
req = (HttpWebRequest) WebRequest.Create (url);
+ req.Timeout = 5000;
req.Method = "POST";
req.SendChunked = false;
req.KeepAlive = false;
req.Abort ();
req = (HttpWebRequest) WebRequest.Create (url);
+ req.Timeout = 5000;
req.Method = "POST";
req.SendChunked = true;
req.KeepAlive = false;
req.AllowWriteStreamBuffering = false;
+ req.GetRequestStream ().WriteByte (1);
req.BeginGetResponse (null, null);
req.Abort ();
req = (HttpWebRequest) WebRequest.Create (url);
+ req.Timeout = 5000;
req.Method = "POST";
req.ContentLength = 5;
req.SendChunked = false;
req.KeepAlive = false;
req.AllowWriteStreamBuffering = false;
+ req.GetRequestStream ().WriteByte (5);
req.BeginGetResponse (null, null);
req.Abort ();
req = (HttpWebRequest) WebRequest.Create (url);
+ req.Timeout = 5000;
req.Method = "POST";
req.SendChunked = false;
req.KeepAlive = true;
req.AllowWriteStreamBuffering = false;
-#if NET_2_0
+
req.BeginGetResponse (null, null);
req.Abort ();
-#else
- try {
- req.BeginGetResponse (null, null);
- } catch (ProtocolViolationException ex) {
- // Either ContentLength must be set to a non-negative
- // number, or SendChunked set to true in order to perform
- // the write operation when AllowWriteStreamBuffering
- // is disabled
- Assert.IsNull (ex.InnerException, "#A2");
- Assert.IsNotNull (ex.Message, "#A3");
- } finally {
- req.Abort ();
- }
-#endif
req = (HttpWebRequest) WebRequest.Create (url);
+ req.Timeout = 5000;
req.Method = "POST";
req.SendChunked = false;
req.KeepAlive = false;
req.Abort ();
req = (HttpWebRequest) WebRequest.Create (url);
+ req.Timeout = 5000;
req.Method = "POST";
req.SendChunked = false;
req.KeepAlive = true;
req.Abort ();
req = (HttpWebRequest) WebRequest.Create (url);
+ req.Timeout = 5000;
req.Method = "GET";
req.SendChunked = true;
-#if NET_2_0
+
req.BeginGetResponse (null, null);
req.Abort ();
-#else
- try {
- req.BeginGetResponse (null, null);
- Assert.Fail ("#B1");
- } catch (ProtocolViolationException ex) {
- // Content-Length cannot be set for a
- // non-write operation
- Assert.IsNull (ex.InnerException, "#B2");
- Assert.IsNotNull (ex.Message, "#B3");
- } finally {
- req.Abort ();
- }
-#endif
req = (HttpWebRequest) WebRequest.Create (url);
+ req.Timeout = 5000;
req.Method = "GET";
req.ContentLength = 5;
-#if NET_2_0
+
req.BeginGetResponse (null, null);
req.Abort ();
-#else
- try {
- req.BeginGetResponse (null, null);
- Assert.Fail ("#C1");
- } catch (ProtocolViolationException ex) {
- // Content-Length cannot be set for a
- // non-write operation
- Assert.IsNull (ex.InnerException, "#C2");
- Assert.IsNotNull (ex.Message, "#C3");
- } finally {
- req.Abort ();
- }
-#endif
req = (HttpWebRequest) WebRequest.Create (url);
+ req.Timeout = 5000;
req.Method = "GET";
req.ContentLength = 0;
-#if NET_2_0
+
req.BeginGetResponse (null, null);
req.Abort ();
-#else
- try {
- req.BeginGetResponse (null, null);
- Assert.Fail ("#D1");
- } catch (ProtocolViolationException ex) {
- // Content-Length cannot be set for a
- // non-write operation
- Assert.IsNull (ex.InnerException, "#D2");
- Assert.IsNotNull (ex.Message, "#D3");
- } finally {
- req.Abort ();
- }
-#endif
}
}
req.Method = "POST";
req.Abort ();
-#if NET_2_0
try {
req.BeginGetRequestStream (null, null);
Assert.Fail ("#1");
Assert.IsNull (ex.Response, "#5");
Assert.AreEqual (WebExceptionStatus.RequestCanceled, ex.Status, "#6");
}
-#else
- IAsyncResult ar = req.BeginGetRequestStream (null, null);
- try {
- req.EndGetRequestStream (ar);
- Assert.Fail ("#1");
- } catch (WebException ex) {
- // The underlying connection was closed: the request was canceled
- Assert.AreEqual (typeof (WebException), ex.GetType (), "#2");
- Assert.IsNull (ex.InnerException, "#3");
- Assert.IsNotNull (ex.Message, "#4");
- Assert.IsNull (ex.Response, "#5");
- Assert.AreEqual (WebExceptionStatus.RequestCanceled, ex.Status, "#6");
- }
-#endif
}
}
[Test] // bug #511851
public void BeginGetResponse_Request_Aborted ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9155);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
[Test]
public void EndGetRequestStream_AsyncResult_Null ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9156);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
[Category ("NotWorking")]
public void EndGetResponse_AsyncResult_Invalid ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9157);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
[Test]
public void EndGetResponse_AsyncResult_Null ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9158);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
[Test] // bug #429200
public void GetRequestStream ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 10000);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
[Test] // bug #511851
public void GetRequestStream_Request_Aborted ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 10001);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
}
[Test] // bug #510661
+ [Category ("NotWorking")] // #5842
public void GetRequestStream_Close_NotAllBytesWritten ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 10002);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
}
[Test] // bug #510642
+ [Category ("NotWorking")] // #5842
public void GetRequestStream_Write_Overflow ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8001);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8010);
string url = "http://" + ep.ToString () + "/test/";
// buffered, non-chunked
[Test] // bug #511851
public void GetResponse_Request_Aborted ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 10100);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
#endif
public void AllowAutoRedirect ()
{
- IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8764);
+ IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8765);
string url = "http://" + localEP.ToString () + "/original/";
// allow autoredirect
[Category ("NotWorking")]
public void InternalServerError ()
{
- IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8764);
+ IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8766);
string url = "http://" + localEP.ToString () + "/original/";
// POST
[Category ("NotWorking")] // #B3 fails; we get a SocketException: An existing connection was forcibly closed by the remote host
public void NoContentLength ()
{
- IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8764);
+ IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8767);
string url = "http://" + localEP.ToString () + "/original/";
// POST
req.GetResponse ();
Assert.Fail ("#A1");
} catch (WebException ex) {
-#if NET_2_0
// The underlying connection was closed:
// An unexpected error occurred on a
// receive
HttpWebResponse webResponse = ex.Response as HttpWebResponse;
Assert.IsNull (webResponse, "#A11");
-#else
- // The remote server returned an error:
- // (500) Internal Server Error
- Assert.AreEqual (typeof (WebException), ex.GetType (), "#A2");
- Assert.IsNull (ex.InnerException, "#A3");
- Assert.AreEqual (WebExceptionStatus.ProtocolError, ex.Status, "#A4");
-
- HttpWebResponse webResponse = ex.Response as HttpWebResponse;
- Assert.IsNotNull (webResponse, "#A5");
- Assert.AreEqual ("POST", webResponse.Method, "#A6");
- webResponse.Close ();
-#endif
}
responder.Stop ();
[Test] // bug #513087
public void NonStandardVerb ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8123);
string url = "http://" + ep.ToString () + "/moved/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (VerbEchoHandler))) {
[Category ("NotWorking")] // Assert #2 fails
public void NotModifiedSince ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9123);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (NotModifiedSinceHandler))) {
req.KeepAlive = false;
req.Timeout = 20000;
req.ReadWriteTimeout = 20000;
-#if NET_2_0
req.Headers.Add (HttpRequestHeader.IfNoneMatch, "898bbr2347056cc2e096afc66e104653");
-#else
- req.Headers.Add ("If-None-Match", "898bbr2347056cc2e096afc66e104653");
-#endif
req.IfModifiedSince = new DateTime (2010, 01, 04);
DateTime start = DateTime.Now;
}
}
-#if NET_2_0
- [Test] // bug #324182
-#if TARGET_JVM
- [Category ("NotWorking")]
-#endif
- public void Stream_CanTimeout ()
- {
- IPEndPoint localEP = new IPEndPoint (IPAddress.Loopback, 8764);
- string url = "http://" + localEP.ToString () + "/original/";
-
- // allow autoredirect
- using (SocketResponder responder = new SocketResponder (localEP, new SocketRequestHandler (RedirectRequestHandler))) {
- responder.Start ();
-
- HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
- req.Method = "POST";
- req.Timeout = 2000;
- req.ReadWriteTimeout = 2000;
- req.KeepAlive = false;
- Stream rs = req.GetRequestStream ();
- Assert.IsTrue (rs.CanTimeout, "#1");
- rs.Close ();
- using (HttpWebResponse resp = (HttpWebResponse) req.GetResponse ()) {
- Stream os = resp.GetResponseStream ();
- Assert.IsTrue (os.CanTimeout, "#2");
- os.Close ();
- }
- responder.Stop ();
- }
- }
-#endif
-
[Test] // bug #353495
[Category ("NotWorking")]
public void LastModifiedKind ()
//string rawLastMod = resp.Headers ["Last-Modified"];
resp.Close ();
//Assert.AreEqual ("Tue, 15 Jan 2008 08:59:59 GMT", rawLastMod, "#1");
-#if NET_2_0
Assert.AreEqual (DateTimeKind.Local, lastMod.Kind, "#2");
-#endif
req = (HttpWebRequest) WebRequest.Create (reqURL);
req.IfModifiedSince = lastMod;
try {
protected abstract void Run ();
}
-#if NET_2_0
[Test]
public void BeginGetRequestStream ()
{
Assert.AreEqual(data64KB, received);
}
+ /*
+ Invalid test: it does not work on linux.
+ [pid 30973] send(9, "POST / HTTP/1.1\r\nContent-Length:"..., 89, 0) = 89
+ Abort set
+ [pid 30970] send(16, "HTTP/1.1 200 OK\r\nServer: Mono-HT"..., 133, 0) = 133
+ Calling abort
+ [pid 30970] close(16) = 0
+ Closing!!!
+ [pid 30980] send(9, "\213t\326\350\312u\36n\234\351\225L\r\243a\200\226\371\350F\271~oZ\32\270\24\226z4\211\345"..., 65536, 0) = 65536
+ Writing...
+ [pid 30966] close(4) = 0
+ OK
+ *
+ The server sideis closed (FD 16) and the send on the client side (FD 9) succeeds.
[Test]
+ [Category("NotWorking")]
public void WriteServerAborts ()
{
ManualResetEvent abort = new ManualResetEvent (false);
c.Response.Abort();
});
}
+ **/
[Test]
public void Read ()
}
}
+#if NET_4_0
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void NullHost ()
+ {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
+ req.Host = null;
+ }
+
+ [Test]
+ public void NoHost ()
+ {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
+ Assert.AreEqual (req.Host, "go-mono.com");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void EmptyHost ()
+ {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
+ req.Host = "";
+ }
+
+ [Test]
+ public void HostAndPort ()
+ {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com:80");
+ Assert.AreEqual ("go-mono.com", req.Host, "#01");
+ req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com:9000");
+ Assert.AreEqual ("go-mono.com:9000", req.Host, "#02");
+ }
+
+ [Test]
+ public void PortRange ()
+ {
+ for (int i = 0; i < 65536; i++) {
+ if (i == 80)
+ continue;
+ string s = i.ToString ();
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com:" + s);
+ Assert.AreEqual ("go-mono.com:" + s, req.Host, "#" + s);
+ }
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void PortBelow ()
+ {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
+ req.Host = "go-mono.com:-1";
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void PortAbove ()
+ {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
+ req.Host = "go-mono.com:65536";
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void HostTooLong ()
+ {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
+ string s = new string ('a', 100);
+ req.Host = s + "." + s + "." + s + "." + s + "." + s + "." + s; // Over 255 bytes
+ }
+
+ [Test]
+ [Category ("NotWorking")] // #5490
+ public void InvalidNamesThatWork ()
+ {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
+ req.Host = "-";
+ req.Host = "-.-";
+ req.Host = "รก";
+ req.Host = new string ('a', 64); // Should fail. Max. is 63.
+ }
+
+ [Test]
+ public void NoDate ()
+ {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
+ Assert.AreEqual (DateTime.MinValue, req.Date);
+ }
+
+ [Test]
+ public void UtcDate ()
+ {
+ HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
+ req.Date = DateTime.UtcNow;
+ DateTime date = req.Date;
+ Assert.AreEqual (DateTimeKind.Local, date.Kind);
+ }
+
+ [Test]
+ public void AddAndRemoveDate ()
+ {
+ // Neil Armstrong set his foot on Moon
+ var landing = new DateTime (1969, 7, 21, 2, 56, 0, DateTimeKind.Utc);
+ Assert.AreEqual (621214377600000000, landing.Ticks);
+ var unspecified = new DateTime (1969, 7, 21, 2, 56, 0);
+ var local = landing.ToLocalTime ();
+
+ var req = (HttpWebRequest)WebRequest.Create ("http://www.mono-project.com/");
+ req.Date = landing;
+ Assert.AreEqual (DateTimeKind.Local, req.Date.Kind);
+ Assert.AreEqual (local.Ticks, req.Date.Ticks);
+ Assert.AreEqual (local, req.Date);
+
+ req.Date = unspecified;
+ Assert.AreEqual (DateTimeKind.Local, req.Date.Kind);
+ Assert.AreEqual (unspecified.Ticks, req.Date.Ticks);
+ Assert.AreEqual (unspecified, req.Date);
+
+ req.Date = local;
+ Assert.AreEqual (DateTimeKind.Local, req.Date.Kind);
+ Assert.AreEqual (local.Ticks, req.Date.Ticks);
+ Assert.AreEqual (local, req.Date);
+
+ req.Date = DateTime.MinValue;
+ Assert.AreEqual (DateTimeKind.Unspecified, DateTime.MinValue.Kind);
+ Assert.AreEqual (DateTimeKind.Unspecified, req.Date.Kind);
+ Assert.AreEqual (0, req.Date.Ticks);
+ }
+#endif
class ListenerScope : IDisposable {
EventWaitHandle completed;
public HttpListener listener;
this.listener.Stop ();
}
}
-#endif
#if !TARGET_JVM
class SslHttpServer : HttpServer {
[Test]
public void BeginRead ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9124);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
[Test]
public void BeginWrite_Request_Aborted ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9125);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
[Test]
public void CanRead ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9126);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
[Test]
public void CanSeek ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9127);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
}
}
-#if NET_2_0
- [Test]
+ [Test] // bug #324182
+#if TARGET_JVM
+ [Category ("NotWorking")]
+#endif
public void CanTimeout ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9128);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
}
}
}
-#endif
[Test]
- [Category ("NotWorking")]
public void CanWrite ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9129);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
[Test]
public void Read ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9130);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
[Test]
public void ReadByte ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9140);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
}
}
-#if NET_2_0
[Test]
public void ReadTimeout ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9141);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
}
}
}
-#endif
[Test]
public void Seek ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9142);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
[Test]
public void Write_Buffer_Null ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9143);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
}
[Test]
- [Category ("NotWorking")]
public void Write_Count_Negative ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9144);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
}
[Test]
- [Category ("NotWorking")]
public void Write_Count_Overflow ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9145);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
}
[Test]
- [Category ("NotWorking")]
public void Write_Offset_Negative ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9146);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
}
[Test]
- [Category ("NotWorking")]
public void Write_Offset_Overflow ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9147);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
[Test]
public void Write_Request_Aborted ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9148);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
[Category ("NotWorking")]
public void Write_Stream_Closed ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9149);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
[Test]
public void WriteByte_Request_Aborted ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9150);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
}
}
-#if NET_2_0
[Test]
public void WriteTimeout ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 9151);
string url = "http://" + ep.ToString () + "/test/";
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebRequestTest.EchoRequestHandler))) {
}
}
}
-#endif
}
-#if NET_2_0
- public static class StreamExtensions {
+ static class StreamExtensions {
public static int ReadAll(this Stream stream, byte[] buffer, int offset, int count)
{
int totalRead = 0;
}
}
- public class ExceptionAssert {
+ static class ExceptionAssert {
/// <summary>
/// Asserts that the function throws an exception.
/// </summary>
return (T) actualException;
}
}
-#endif
}