* [System] Fix line endings for a few files.
Best reviewed by not showing whitespace changes (should be empty diff in that case).
* [System] Fix potential crash in CookieParserTests.
Socket.EndAccept can throw an exception, which will crash the process if it
happens on a threadpool. So handle any exceptions when calling
Socket.EndAccept, and propagate those exceptions out of any threadpool code.
* [System.Net.Http] Throw a PlatformNotSupported exception when using HttpClientHandler on watchOS.
* [System.Net.Http] Tweak tests after watchOS API change.
Unfortunately the [ExpectedException] attribute can't be put on an entire
class, so remove the [Category ("RequiresBSDSockets")] attribute on the class
and instead decorate each test with an [ExpectedException] attribute.
* [System] Extract the HttpListenerResponseHelper class to a separate file.
Extract the HttpListenerResponseHelper class to a separate file so that it's
easier to replace the HttpListenerResponse implementation by using a different
file.
* [System] Throw a PlatformNotSupported exception when using the networking stack on watchOS.
* [System] Tweak tests after watchOS API changes.
Unfortunately the [ExpectedException] attribute can't be put on an entire
class, so remove the [Category ("RequiresBSDSockets")] attribute on the class
and instead decorate each test with an [ExpectedException] attribute.
* [System] Fix potential crash in SocketAcceptAsyncTest.
Fix potential crash in SocketAcceptAsyncTest by catching any exceptions in
code executed on the threadpool so that we never end up with unhandled
exceptions (which may terminate the process).
* [System] Avoid logic in SetUp attributes in tests.
Any type of exception in [SetUp] attributes causes all tests to fail with that
exception.
This even happens for tests that do not need the logic in the [SetUp]
attribute.
So rewrite tests a bit to not use [SetUp] when we can reasonably avoid it, and
instead instantiate class-level variables on first use. This ensures that any
exceptions that occur when initializing those variables are attributed to the
corresponding test, and not all of them.
* [System] Make exception handler (for test) catch more exceptions to avoid unhandled exceptions causing process termination.
* [System] Remove Obsolete attribute on API that throws PNSE.
include $(topdir)/build/profiles/monotouch.make
PROFILE_MCS_FLAGS += \
+ -d:FEATURE_NO_BSD_SOCKETS \
-d:MONOTOUCH_WATCH
NO_THREAD_ABORT=1
include $(topdir)/build/profiles/monotouch_runtime.make
PROFILE_MCS_FLAGS += \
+ -d:FEATURE_NO_BSD_SOCKETS \
-d:MONOTOUCH_WATCH
NO_THREAD_ABORT=1
--- /dev/null
+//
+// System.Net.Http/HttpClientHandler.cs
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections.Generic;
+using System.Net.Security;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading.Tasks;
+using System.Threading;
+
+namespace System.Net.Http
+{
+ public class HttpClientHandler : HttpMessageHandler
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.Http.HttpClientHandler is not supported on the current platform.";
+
+ public HttpClientHandler ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public bool AllowAutoRedirect {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public DecompressionMethods AutomaticDecompression {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public ClientCertificateOption ClientCertificateOptions {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public CookieContainer CookieContainer {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public ICredentials Credentials {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int MaxAutomaticRedirections {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public long MaxRequestContentBufferSize {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool PreAuthenticate {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public IWebProxy Proxy {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public virtual bool SupportsAutomaticDecompression {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public virtual bool SupportsProxy {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public virtual bool SupportsRedirectConfiguration {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool UseCookies {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool UseDefaultCredentials {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool UseProxy {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ HttpResponseMessage CreateResponseMessage (HttpWebResponse wr, HttpRequestMessage requestMessage, CancellationToken cancellationToken)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected internal async override Task<HttpResponseMessage> SendAsync (HttpRequestMessage request, CancellationToken cancellationToken)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+#if NETSTANDARD
+ public bool CheckCertificateRevocationList {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public X509CertificateCollection ClientCertificates {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public ICredentials DefaultProxyCredentials {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int MaxConnectionsPerServer {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int MaxResponseHeadersLength {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public IDictionary<string,object> Properties {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Func<HttpRequestMessage,X509Certificate2,X509Chain,SslPolicyErrors,bool> ServerCertificateCustomValidationCallback {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public SslProtocols SslProtocols {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+#endif
+ }
+}
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Properties_Defaults ()
{
var h = new HttpClientHandler ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Properties_Invalid ()
{
var h = new HttpClientHandler ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Properties_AfterClientCreation ()
{
var h = new HttpClientHandler ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Disposed ()
{
var h = new HttpClientHandler ();
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ // Using HttpClientHandler, which indirectly requires BSD sockets.
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CancelRequestViaProxy ()
{
var handler = new HttpClientHandler {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Proxy_Disabled ()
{
var pp = WebRequest.DefaultWebProxy;
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Complete_Default ()
{
bool? failed = null;
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Complete_Version_1_0 ()
{
bool? failed = null;
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Complete_ClientHandlerSettings ()
{
bool? failed = null;
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Complete_CustomHeaders ()
{
bool? failed = null;
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Complete_CustomHeaders_SpecialSeparators ()
{
bool? failed = null;
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Complete_CustomHeaders_Host ()
{
bool? failed = null;
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Transfer_Encoding_Chunked ()
{
bool? failed = null;
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Transfer_Encoding_Custom ()
{
bool? failed = null;
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Complete_Content ()
{
var listener = CreateListener (l => {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Complete_Content_MaxResponseContentBufferSize ()
{
var listener = CreateListener (l => {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Complete_Content_MaxResponseContentBufferSize_Error ()
{
var listener = CreateListener (l => {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Complete_NoContent ()
{
foreach (var method in new HttpMethod[] { HttpMethod.Post, HttpMethod.Put, HttpMethod.Delete }) {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Complete_Error ()
{
var listener = CreateListener (l => {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Content_Get ()
{
var listener = CreateListener (l => {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Content_BomEncoding ()
{
var listener = CreateListener (l => {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Content_Put ()
{
bool passed = false;
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Content_Put_CustomStream ()
{
bool passed = false;
[Test]
[Category ("MobileNotWorking")] // Missing encoding
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetString_Many ()
{
Action<HttpListenerContext> context = (HttpListenerContext l) => {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetByteArray_ServerError ()
{
var listener = CreateListener (l => {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void DisallowAutoRedirect ()
{
var listener = CreateListener (l => {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void RequestUriAfterRedirect ()
{
var listener = CreateListener (l => {
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
/*
* Properties may only be modified before sending the first request.
*/
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ // Using HttpClientHandler, which indirectly requires BSD sockets.
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
/*
* However, this policy is not enforced for custom handlers and there
* is also no way a derived class could tell its HttpClientHandler parent
--- /dev/null
+System.Net.Http/HttpClientHandler.cs
--- /dev/null
+#include System.Net.Http.dll.sources
+System.Net.Http/HttpClientHandler.platformnotsupported.cs
--- /dev/null
+//
+// System.Net.Mail.SmtpClient.cs
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.ComponentModel;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading.Tasks;
+
+namespace System.Net.Mail {
+ public class SmtpClient
+ : IDisposable
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.Mail.SmtpClient is not supported on the current platform.";
+
+ public SmtpClient ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public SmtpClient (string host)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public SmtpClient (string host, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+#if SECURITY_DEP
+ [MonoTODO("Client certificates not used")]
+ public X509CertificateCollection ClientCertificates {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+#endif
+
+ public string TargetName { get; set; }
+
+ public ICredentialsByHost Credentials {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public SmtpDeliveryMethod DeliveryMethod {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool EnableSsl {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string Host {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string PickupDirectoryLocation {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int Port {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public SmtpDeliveryFormat DeliveryFormat {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public ServicePoint ServicePoint {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int Timeout {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool UseDefaultCredentials {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+#pragma warning disable 0067 // The event `System.Net.Mail.SmtpClient.SendCompleted' is never used
+ public event SendCompletedEventHandler SendCompleted;
+#pragma warning restore 0067
+
+ public void Dispose ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected void OnSendCompleted (AsyncCompletedEventArgs e)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Send (MailMessage message)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Send (string from, string to, string subject, string body)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task SendMailAsync (MailMessage message)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task SendMailAsync (string from, string recipients, string subject, string body)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void SendAsync (MailMessage message, object userToken)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void SendAsync (string from, string to, string subject, string body, object userToken)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void SendAsyncCancel ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
+
public void Bind (EndPoint localEP)
{
+#if FEATURE_NO_BSD_SOCKETS
+ throw new PlatformNotSupportedException ("System.Net.Sockets.Socket:Bind is not supported on this platform.");
+#else
ThrowIfDisposedAndClosed ();
if (localEP == null)
is_bound = true;
seed_endpoint = localEP;
+#endif // FEATURE_NO_BSD_SOCKETS
}
private static void Bind_internal (SafeSocketHandle safeHandle, SocketAddress sa, out int error)
--- /dev/null
+//
+// System.Net.Sockets.TcpClient.cs
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Net;
+using System.Threading.Tasks;
+
+namespace System.Net.Sockets
+{
+ public class TcpClient : IDisposable
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.Sockets.TcpClient is not supported on the current platform.";
+
+ public TcpClient ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public TcpClient (AddressFamily family)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public TcpClient (IPEndPoint localEP)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public TcpClient (string hostname, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected bool Active {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Socket Client {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int Available {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool Connected {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool ExclusiveAddressUse {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public LingerOption LingerState {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool NoDelay {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int ReceiveBufferSize {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int ReceiveTimeout {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int SendBufferSize {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int SendTimeout {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public void Close ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Connect (IPEndPoint remoteEP)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Connect (IPAddress address, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Connect (string hostname, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Connect (IPAddress[] ipAddresses, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void EndConnect (IAsyncResult asyncResult)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public IAsyncResult BeginConnect (IPAddress address, int port, AsyncCallback requestCallback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public IAsyncResult BeginConnect (IPAddress[] addresses, int port, AsyncCallback requestCallback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public IAsyncResult BeginConnect (string host, int port, AsyncCallback requestCallback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Dispose ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ ~TcpClient ()
+ {
+ }
+
+ public NetworkStream GetStream()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task ConnectAsync (IPAddress address, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task ConnectAsync (IPAddress[] addresses, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task ConnectAsync (string host, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
--- /dev/null
+//
+// System.Net.Sockets.TcpListener.cs
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Net;
+using System.Threading.Tasks;
+
+namespace System.Net.Sockets
+{
+ public class TcpListener
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.Sockets.TcpListener is not supported on the current platform.";
+
+ public TcpListener (int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public TcpListener (IPEndPoint localEP)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public TcpListener (IPAddress localaddr, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected bool Active {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public EndPoint LocalEndpoint {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Socket Server {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool ExclusiveAddressUse {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Socket AcceptSocket ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public TcpClient AcceptTcpClient ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ ~TcpListener ()
+ {
+ }
+
+ public bool Pending ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Start ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Start (int backlog)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public IAsyncResult BeginAcceptSocket (AsyncCallback callback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public IAsyncResult BeginAcceptTcpClient (AsyncCallback callback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Socket EndAcceptSocket (IAsyncResult asyncResult)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public TcpClient EndAcceptTcpClient (IAsyncResult asyncResult)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Stop ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task<Socket> AcceptSocketAsync ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task<TcpClient> AcceptTcpClientAsync ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
--- /dev/null
+//
+// System.Net.Sockets.UdpClient.cs
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Threading.Tasks;
+
+namespace System.Net.Sockets
+{
+ public class UdpClient : IDisposable
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.Sockets.UdpClient is not supported on the current platform.";
+
+ public UdpClient ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public UdpClient(AddressFamily family)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public UdpClient (int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public UdpClient (IPEndPoint localEP)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public UdpClient (int port, AddressFamily family)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public UdpClient (string hostname, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Close ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Connect (IPEndPoint endPoint)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Connect (IPAddress addr, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Connect (string hostname, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void DropMulticastGroup (IPAddress multicastAddr)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void DropMulticastGroup (IPAddress multicastAddr, int ifindex)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void JoinMulticastGroup (IPAddress multicastAddr)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void JoinMulticastGroup (int ifindex, IPAddress multicastAddr)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void JoinMulticastGroup (IPAddress multicastAddr, int timeToLive)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void JoinMulticastGroup (IPAddress multicastAddr, IPAddress localAddress)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public byte [] Receive (ref IPEndPoint remoteEP)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public int Send (byte [] dgram, int bytes)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public int Send (byte [] dgram, int bytes, IPEndPoint endPoint)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public int Send (byte [] dgram, int bytes, string hostname, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public IAsyncResult BeginSend (byte[] datagram, int bytes, AsyncCallback requestCallback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public IAsyncResult BeginSend (byte[] datagram, int bytes, IPEndPoint endPoint, AsyncCallback requestCallback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public IAsyncResult BeginSend (byte[] datagram, int bytes, string hostname, int port, AsyncCallback requestCallback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public int EndSend (IAsyncResult asyncResult)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public IAsyncResult BeginReceive (AsyncCallback requestCallback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public byte[] EndReceive (IAsyncResult asyncResult, ref IPEndPoint remoteEP)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected bool Active {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Socket Client {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int Available {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool DontFragment {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool EnableBroadcast {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool ExclusiveAddressUse {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool MulticastLoopback {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public short Ttl {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public void Dispose ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ ~UdpClient ()
+ {
+ }
+
+ public Task<UdpReceiveResult> ReceiveAsync ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task<int> SendAsync (byte[] datagram, int bytes)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task<int> SendAsync (byte[] datagram, int bytes, IPEndPoint endPoint)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task<int> SendAsync (byte[] datagram, int bytes, string hostname, int port)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
--- /dev/null
+//
+// ClientWebSocket.cs
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace System.Net.WebSockets
+{
+ public class ClientWebSocket : WebSocket, IDisposable
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.WebSockets.ClientWebSocket is not supported on the current platform.";
+
+ public ClientWebSocket ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override void Dispose ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override void Abort ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public ClientWebSocketOptions Options {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override WebSocketState State {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override WebSocketCloseStatus? CloseStatus {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override string CloseStatusDescription {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override string SubProtocol {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Task ConnectAsync (Uri uri, CancellationToken cancellationToken)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override Task SendAsync (ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override Task<WebSocketReceiveResult> ReceiveAsync (ArraySegment<byte> buffer, CancellationToken cancellationToken)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override Task CloseAsync (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override Task CloseOutputAsync (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
[Obsolete ("Use BeginGetHostEntry instead")]
public static IAsyncResult BeginGetHostByName (string hostName, AsyncCallback requestCallback, object stateObject)
{
+#if FEATURE_NO_BSD_SOCKETS
+ throw new PlatformNotSupportedException ("System.Net.Dns:BeginGetHostByName is not supported on this platform.");
+#else
if (hostName == null)
throw new ArgumentNullException ("hostName");
GetHostByNameCallback c = new GetHostByNameCallback (GetHostByName);
return c.BeginInvoke (hostName, requestCallback, stateObject);
+#endif // FEATURE_NO_BSD_SOCKETS
}
[Obsolete ("Use BeginGetHostEntry instead")]
public static IAsyncResult BeginResolve (string hostName, AsyncCallback requestCallback, object stateObject)
{
+#if FEATURE_NO_BSD_SOCKETS
+ throw new PlatformNotSupportedException ("System.Net.Dns:BeginResolve is not supported on this platform.");
+#else
if (hostName == null)
throw new ArgumentNullException ("hostName");
ResolveCallback c = new ResolveCallback (Resolve);
return c.BeginInvoke (hostName, requestCallback, stateObject);
+#endif // FEATURE_NO_BSD_SOCKETS
}
public static IAsyncResult BeginGetHostAddresses (string hostNameOrAddress, AsyncCallback requestCallback, object state)
public static IAsyncResult BeginGetHostEntry (string hostNameOrAddress, AsyncCallback requestCallback, object stateObject)
{
+#if FEATURE_NO_BSD_SOCKETS
+ throw new PlatformNotSupportedException ("System.Net.Dns:GetHostEntry is not supported on this platform.");
+#else
if (hostNameOrAddress == null)
throw new ArgumentNullException ("hostName");
if (hostNameOrAddress == "0.0.0.0" || hostNameOrAddress == "::0")
GetHostEntryNameCallback c = new GetHostEntryNameCallback (GetHostEntry);
return c.BeginInvoke (hostNameOrAddress, requestCallback, stateObject);
+#endif // FEATURE_NO_BSD_SOCKETS
}
public static IAsyncResult BeginGetHostEntry (IPAddress address, AsyncCallback requestCallback, object stateObject)
{
+#if FEATURE_NO_BSD_SOCKETS
+ throw new PlatformNotSupportedException ("System.Net.Dns:BeginGetHostEntry is not supported on this platform.");
+#else
if (address == null)
throw new ArgumentNullException ("address");
GetHostEntryIPCallback c = new GetHostEntryIPCallback (GetHostEntry);
return c.BeginInvoke (address, requestCallback, stateObject);
+#endif // FEATURE_NO_BSD_SOCKETS
}
[Obsolete ("Use EndGetHostEntry instead")]
[Obsolete ("Use GetHostEntry instead")]
public static IPHostEntry GetHostByName (string hostName)
{
+#if FEATURE_NO_BSD_SOCKETS
+ if (!string.IsNullOrEmpty (hostName))
+ throw new PlatformNotSupportedException ("System.Net.Dns:GetHostByName is not supported on this platform.");
+#endif // FEATURE_NO_BSD_SOCKETS
if (hostName == null)
throw new ArgumentNullException ("hostName");
string h_name;
[Obsolete ("Use GetHostEntry instead")]
public static IPHostEntry Resolve(string hostName)
{
+#if FEATURE_NO_BSD_SOCKETS
+ throw new PlatformNotSupportedException ("System.Net.Dns:Resolve is not supported on this platform.");
+#else
if (hostName == null)
throw new ArgumentNullException ("hostName");
ret = GetHostByName(hostName);
return ret;
+#endif // FEATURE_NO_BSD_SOCKETS
}
public static Task<IPAddress[]> GetHostAddressesAsync (string hostNameOrAddress)
--- /dev/null
+//
+// System.Net.FtpbRequestCreator.cs
+//
+// Authors:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Net
+{
+ class FtpRequestCreator : IWebRequestCreate
+ {
+ internal const string EXCEPTION_MESSAGE = "System.Net.FtpRequestCreator is not supported on the current platform.";
+ public WebRequest Create (Uri uri)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
--- /dev/null
+//
+// System.Net.FtpWebRequest.cs
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.IO;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Net
+{
+ public sealed class FtpWebRequest : WebRequest
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.FtpWebRequest is not supported on the current platform.";
+
+ FtpWebRequest ()
+ {
+ }
+
+ public X509CertificateCollection ClientCertificates {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override string ConnectionGroupName {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override string ContentType {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override long ContentLength {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public long ContentOffset {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override ICredentials Credentials {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+#if !MOBILE
+ public static new RequestCachePolicy DefaultCachePolicy {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+#endif
+
+ public bool EnableSsl {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override WebHeaderCollection Headers {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool KeepAlive {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override string Method {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override bool PreAuthenticate {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override IWebProxy Proxy {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int ReadWriteTimeout {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string RenameTo {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override Uri RequestUri {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public ServicePoint ServicePoint {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool UsePassive {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override bool UseDefaultCredentials {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool UseBinary {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override int Timeout {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override void Abort ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override WebResponse EndGetResponse (IAsyncResult asyncResult)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override WebResponse GetResponse ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override Stream EndGetRequestStream (IAsyncResult asyncResult)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override Stream GetRequestStream ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
--- /dev/null
+//
+// System.Net.FtpWebResponse.cs
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.IO;
+
+namespace System.Net
+{
+ public class FtpWebResponse : WebResponse
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.FtpWebResponse is not supported on the current platform.";
+
+ FtpWebResponse ()
+ {
+ }
+
+ public override long ContentLength {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override WebHeaderCollection Headers {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override Uri ResponseUri {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public DateTime LastModified {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string BannerMessage {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string WelcomeMessage {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string ExitMessage {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public FtpStatusCode StatusCode {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override bool SupportsHeaders {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string StatusDescription {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override void Close ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override Stream GetResponseStream ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
--- /dev/null
+//
+// System.Net.HttpListener
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Threading.Tasks;
+
+namespace System.Net {
+ public sealed class HttpListener : IDisposable
+ {
+ internal const string EXCEPTION_MESSAGE = "System.Net.HttpListener is not supported on the current platform.";
+
+ public HttpListener ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ internal HttpListener (System.Security.Cryptography.X509Certificates.X509Certificate certificate, Mono.Net.Security.IMonoTlsProvider tlsProvider, Mono.Security.Interface.MonoTlsSettings tlsSettings)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public AuthenticationSchemes AuthenticationSchemes {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public AuthenticationSchemeSelector AuthenticationSchemeSelectorDelegate {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool IgnoreWriteExceptions {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool IsListening {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public static bool IsSupported {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public HttpListenerPrefixCollection Prefixes {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string Realm {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool UnsafeConnectionNtlmAuthentication {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public void Abort ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Close ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public IAsyncResult BeginGetContext (AsyncCallback callback, Object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public HttpListenerContext EndGetContext (IAsyncResult asyncResult)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public HttpListenerContext GetContext ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Start ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Stop ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ void IDisposable.Dispose ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task<HttpListenerContext> GetContextAsync ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
--- /dev/null
+//
+// System.Net.HttpListenerContext
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Security.Principal;
+using System.Threading.Tasks;
+using System.Net.WebSockets;
+
+namespace System.Net {
+ public sealed class HttpListenerContext {
+ const string EXCEPTION_MESSAGE = "System.Net.HttpListenerContext is not supported on the current platform.";
+
+ HttpListenerContext ()
+ {
+ }
+
+ public HttpListenerRequest Request {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public HttpListenerResponse Response {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public IPrincipal User {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync (string subProtocol)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync (string subProtocol, int receiveBufferSize, TimeSpan keepAliveInterval)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync (string subProtocol, int receiveBufferSize, TimeSpan keepAliveInterval, ArraySegment<byte> internalBuffer)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
--- /dev/null
+//
+// System.Net.HttpListenerPrefixCollection.cs
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections;
+using System.Collections.Generic;
+
+namespace System.Net {
+ public class HttpListenerPrefixCollection : ICollection<string>, IEnumerable<string>, IEnumerable
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.HttpListenerPrefixCollection is not supported on the current platform.";
+
+ HttpListenerPrefixCollection ()
+ {
+ }
+
+ public int Count {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool IsReadOnly {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool IsSynchronized {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public void Add (string uriPrefix)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Clear ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public bool Contains (string uriPrefix)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void CopyTo (string [] array, int offset)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void CopyTo (Array array, int offset)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public IEnumerator<string> GetEnumerator ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public bool Remove (string uriPrefix)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
--- /dev/null
+//
+// System.Net.HttpListenerRequest
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections.Specialized;
+using System.IO;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace System.Net {
+ public sealed class HttpListenerRequest
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.HttpListenerRequest is not supported on the current platform.";
+
+ HttpListenerRequest ()
+ {
+ }
+
+ public string [] AcceptTypes {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int ClientCertificateError {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Encoding ContentEncoding {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public long ContentLength64 {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string ContentType {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public CookieCollection Cookies {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool HasEntityBody {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public NameValueCollection Headers {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string HttpMethod {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Stream InputStream {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool IsAuthenticated {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool IsLocal {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool IsSecureConnection {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool KeepAlive {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public IPEndPoint LocalEndPoint {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Version ProtocolVersion {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public NameValueCollection QueryString {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string RawUrl {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public IPEndPoint RemoteEndPoint {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Guid RequestTraceIdentifier {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Uri Url {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Uri UrlReferrer {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string UserAgent {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string UserHostAddress {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string UserHostName {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string [] UserLanguages {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public IAsyncResult BeginGetClientCertificate (AsyncCallback requestCallback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public X509Certificate2 EndGetClientCertificate (IAsyncResult asyncResult)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public X509Certificate2 GetClientCertificate ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public string ServiceName {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public TransportContext TransportContext {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool IsWebSocketRequest {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Task<X509Certificate2> GetClientCertificateAsync ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
cookies.Add (cookie);
}
}
-
- // do not inline into HttpListenerResponse as this recursively brings everything that's
- // reachable by IDisposable.Dispose (and that's quite a lot in this case).
- static class HttpListenerResponseHelper {
-
- internal static string GetStatusDescription (int code)
- {
- switch (code){
- case 100: return "Continue";
- case 101: return "Switching Protocols";
- case 102: return "Processing";
- case 200: return "OK";
- case 201: return "Created";
- case 202: return "Accepted";
- case 203: return "Non-Authoritative Information";
- case 204: return "No Content";
- case 205: return "Reset Content";
- case 206: return "Partial Content";
- case 207: return "Multi-Status";
- case 300: return "Multiple Choices";
- case 301: return "Moved Permanently";
- case 302: return "Found";
- case 303: return "See Other";
- case 304: return "Not Modified";
- case 305: return "Use Proxy";
- case 307: return "Temporary Redirect";
- case 400: return "Bad Request";
- case 401: return "Unauthorized";
- case 402: return "Payment Required";
- case 403: return "Forbidden";
- case 404: return "Not Found";
- case 405: return "Method Not Allowed";
- case 406: return "Not Acceptable";
- case 407: return "Proxy Authentication Required";
- case 408: return "Request Timeout";
- case 409: return "Conflict";
- case 410: return "Gone";
- case 411: return "Length Required";
- case 412: return "Precondition Failed";
- case 413: return "Request Entity Too Large";
- case 414: return "Request-Uri Too Long";
- case 415: return "Unsupported Media Type";
- case 416: return "Requested Range Not Satisfiable";
- case 417: return "Expectation Failed";
- case 422: return "Unprocessable Entity";
- case 423: return "Locked";
- case 424: return "Failed Dependency";
- case 500: return "Internal Server Error";
- case 501: return "Not Implemented";
- case 502: return "Bad Gateway";
- case 503: return "Service Unavailable";
- case 504: return "Gateway Timeout";
- case 505: return "Http Version Not Supported";
- case 507: return "Insufficient Storage";
- }
- return "";
- }
- }
}
#endif
--- /dev/null
+//
+// System.Net.HttpListenerResponse
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.IO;
+using System.Text;
+
+namespace System.Net {
+ public sealed class HttpListenerResponse : IDisposable
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.HttpListenerResponse is not supported on the current platform.";
+
+ HttpListenerResponse ()
+ {
+ }
+
+ public Encoding ContentEncoding {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public long ContentLength64 {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string ContentType {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public CookieCollection Cookies {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public WebHeaderCollection Headers {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool KeepAlive {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Stream OutputStream {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Version ProtocolVersion {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string RedirectLocation {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool SendChunked {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int StatusCode {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string StatusDescription {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ void IDisposable.Dispose ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Abort ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void AddHeader (string name, string value)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void AppendCookie (Cookie cookie)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void AppendHeader (string name, string value)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Close ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Close (byte [] responseEntity, bool willBlock)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void CopyFrom (HttpListenerResponse templateResponse)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void Redirect (string url)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void SetCookie (Cookie cookie)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
--- /dev/null
+//
+// System.Net.HttpListenerResponseHelper
+//
+// Author:
+// Gonzalo Paniagua Javier (gonzalo@novell.com)
+//
+// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Net {
+ // do not inline into HttpListenerResponse as this recursively brings everything that's
+ // reachable by IDisposable.Dispose (and that's quite a lot in this case).
+ static class HttpListenerResponseHelper {
+
+ internal static string GetStatusDescription (int code)
+ {
+ switch (code){
+ case 100: return "Continue";
+ case 101: return "Switching Protocols";
+ case 102: return "Processing";
+ case 200: return "OK";
+ case 201: return "Created";
+ case 202: return "Accepted";
+ case 203: return "Non-Authoritative Information";
+ case 204: return "No Content";
+ case 205: return "Reset Content";
+ case 206: return "Partial Content";
+ case 207: return "Multi-Status";
+ case 300: return "Multiple Choices";
+ case 301: return "Moved Permanently";
+ case 302: return "Found";
+ case 303: return "See Other";
+ case 304: return "Not Modified";
+ case 305: return "Use Proxy";
+ case 307: return "Temporary Redirect";
+ case 400: return "Bad Request";
+ case 401: return "Unauthorized";
+ case 402: return "Payment Required";
+ case 403: return "Forbidden";
+ case 404: return "Not Found";
+ case 405: return "Method Not Allowed";
+ case 406: return "Not Acceptable";
+ case 407: return "Proxy Authentication Required";
+ case 408: return "Request Timeout";
+ case 409: return "Conflict";
+ case 410: return "Gone";
+ case 411: return "Length Required";
+ case 412: return "Precondition Failed";
+ case 413: return "Request Entity Too Large";
+ case 414: return "Request-Uri Too Long";
+ case 415: return "Unsupported Media Type";
+ case 416: return "Requested Range Not Satisfiable";
+ case 417: return "Expectation Failed";
+ case 422: return "Unprocessable Entity";
+ case 423: return "Locked";
+ case 424: return "Failed Dependency";
+ case 500: return "Internal Server Error";
+ case 501: return "Not Implemented";
+ case 502: return "Bad Gateway";
+ case 503: return "Service Unavailable";
+ case 504: return "Gateway Timeout";
+ case 505: return "Http Version Not Supported";
+ case 507: return "Insufficient Storage";
+ }
+ return "";
+ }
+ }
+}
--- /dev/null
+//
+// System.Net.HttpWebRequest
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.IO;
+using System.Net.Security;
+using System.Runtime.Serialization;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Net
+{
+ [Serializable]
+ public class HttpWebRequest : WebRequest, ISerializable
+ {
+ internal const string EXCEPTION_MESSAGE = "System.Net.HttpWebRequest is not supported on the current platform.";
+
+ internal WebConnection WebConnection {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+#if MOBILE
+ public
+#else
+ internal
+#endif
+ HttpWebRequest (Uri uri)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ internal HttpWebRequest (Uri uri, object /* IMonoTlsProvider */ tlsProvider, object /* MonoTlsSettings */ settings = null)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public string Accept {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Uri Address {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool AllowAutoRedirect {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool AllowWriteStreamBuffering {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public virtual bool AllowReadStreamBuffering {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public DecompressionMethods AutomaticDecompression {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ internal bool InternalAllowBuffering {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ internal Mono.Net.Security.IMonoTlsProvider TlsProvider {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ internal Mono.Security.Interface.MonoTlsSettings TlsSettings {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public X509CertificateCollection ClientCertificates {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string Connection {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override string ConnectionGroupName {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override long ContentLength {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ internal long InternalContentLength {
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override string ContentType {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public HttpContinueDelegate ContinueDelegate {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public virtual CookieContainer CookieContainer {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override ICredentials Credentials {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public DateTime Date {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+#if !MOBILE
+ public static new RequestCachePolicy DefaultCachePolicy {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+#endif
+
+ public static int DefaultMaximumErrorResponseLength {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string Expect {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public virtual bool HaveResponse {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override WebHeaderCollection Headers {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string Host {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public DateTime IfModifiedSince {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool KeepAlive {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int MaximumAutomaticRedirections {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int MaximumResponseHeadersLength {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public static int DefaultMaximumResponseHeadersLength {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int ReadWriteTimeout {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public int ContinueTimeout {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string MediaType {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override string Method {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool Pipelined {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override bool PreAuthenticate {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Version ProtocolVersion {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override IWebProxy Proxy {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string Referer {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override Uri RequestUri {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool SendChunked {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public ServicePoint ServicePoint {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ internal ServicePoint ServicePointNoLock {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public virtual bool SupportsCookieContainer {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override int Timeout {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string TransferEncoding {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override bool UseDefaultCredentials {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string UserAgent {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public bool UnsafeAuthenticatedConnectionSharing {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ internal bool ExpectContinue {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ internal ServerCertValidationCallback ServerCertValidationCallback {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ internal Uri AuthUri {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public RemoteCertificateValidationCallback ServerCertificateValidationCallback {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public void AddRange (int range)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void AddRange (int from, int to)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void AddRange (string rangeSpecifier, int range)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void AddRange (string rangeSpecifier, int from, int to)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void AddRange (long range)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void AddRange (long from, long to)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void AddRange (string rangeSpecifier, long range)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public void AddRange (string rangeSpecifier, long from, long to)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override Stream EndGetRequestStream (IAsyncResult asyncResult)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override Stream GetRequestStream()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override WebResponse EndGetResponse (IAsyncResult asyncResult)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public Stream EndGetRequestStream (IAsyncResult asyncResult, out TransportContext transportContext)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override WebResponse GetResponse()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ internal bool FinishedReading {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ internal bool Aborted {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override void Abort ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ internal void DoContinueDelegate (int statusCode, WebHeaderCollection headers)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ internal void SetWriteStreamError (WebExceptionStatus status, Exception exc)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ internal byte[] GetRequestHeaders ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ internal void SetWriteStream (WebConnectionStream stream)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ internal void SetResponseData (WebConnectionData data)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ internal void SetResponseError (WebExceptionStatus status, Exception e, string where)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ internal bool ReuseConnection {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ internal WebConnection StoredConnection {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+ }
+}
--- /dev/null
+//
+// System.Net.HttpWebResponse
+//
+// Author:
+// Rolf Bjarne Kvinge <rolf@xamarin.com>
+//
+// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.Net
+{
+ [Serializable]
+ public class HttpWebResponse : WebResponse, ISerializable, IDisposable
+ {
+ const string EXCEPTION_MESSAGE = "System.Net.HttpWebResponse is not supported on the current platform.";
+
+ [Obsolete ("Serialization is obsoleted for this type", false)]
+ protected HttpWebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public string CharacterSet {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string ContentEncoding {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override long ContentLength {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override string ContentType {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public virtual CookieCollection Cookies {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override WebHeaderCollection Headers {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ [MonoTODO]
+ public override bool IsMutuallyAuthenticated {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public DateTime LastModified {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public virtual string Method {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public Version ProtocolVersion {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override Uri ResponseUri {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string Server {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public virtual HttpStatusCode StatusCode {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public virtual string StatusDescription {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public override bool SupportsHeaders {
+ get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
+ }
+
+ public string GetResponseHeader (string headerName)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ internal void ReadAll ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override Stream GetResponseStream ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ public override void Close ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ void IDisposable.Dispose ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+ }
+}
System.Net/HttpListenerPrefixCollection.cs
System.Net/HttpListenerRequest.cs
System.Net/HttpListenerResponse.cs
+System.Net/HttpListenerResponseHelper.cs
System.Net/HttpListenerTimeoutManager.cs
System.Net/HttpRequestCreator.cs
System.Net/HttpStreamAsyncResult.cs
namespace MonoTests.System.Net.Mail
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class SmtpClientTest
{
- SmtpClient smtp;
+ SmtpClient _smtp;
+ SmtpClient smtp { get { return _smtp ?? (_smtp = new SmtpClient ()); } }
string tempFolder;
[SetUp]
public void GetReady ()
{
- smtp = new SmtpClient ();
tempFolder = Path.Combine (Path.GetTempPath (), this.GetType ().FullName);
if (Directory.Exists (tempFolder))
Directory.Delete (tempFolder, true);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Credentials_Default ()
{
Assert.IsNull (smtp.Credentials);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void DeliveryMethod ()
{
Assert.AreEqual (SmtpDeliveryMethod.Network, smtp.DeliveryMethod, "#1");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void EnableSsl ()
{
Assert.IsFalse (smtp.EnableSsl, "#1");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Host ()
{
smtp.Host = "127.0.0.1";
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Host_Value_Null ()
{
try {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Host_Value_Empty ()
{
try {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PickupDirectoryLocation ()
{
Assert.IsNull (smtp.PickupDirectoryLocation, "#1");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Port ()
{
Assert.AreEqual (25, smtp.Port, "#1");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Port_Value_Invalid ()
{
// zero
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Message_Null ()
{
try {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Network_Host_Null ()
{
try {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_Network_Host_Whitespace ()
{
smtp.Host = " \r\n ";
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_SpecifiedPickupDirectory ()
{
smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_DirectoryNotFound ()
{
Directory.Delete (tempFolder);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_Empty ()
{
smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_IllegalChars ()
{
smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_NotAbsolute ()
{
smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_Null ()
{
smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Timeout ()
{
Assert.AreEqual (100000, smtp.Timeout, "#1");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentOutOfRangeException))]
+#endif
public void Timeout_Value_Negative ()
{
smtp.Timeout = -1;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UseDefaultCredentials_Default ()
{
Assert.IsFalse (smtp.UseDefaultCredentials);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Deliver ()
{
var server = new SmtpServer ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Deliver_Envelope ()
{
var server = new SmtpServer ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Deliver_Async ()
{
// SmtpClient uses BackgroundWorker and listens for the RunWorkerCompleted
{
[TestFixture]
-[Category ("RequiresBSDSockets")]
public class SslStreamTest {
byte[] m_serverCertRaw = { 48, 130, 5, 165, 2, 1, 3, 48, 130, 5, 95, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 160, 130, 5, 80, 4, 130, 5, 76, 48, 130, 5, 72, 48, 130, 2, 87, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 6, 160, 130, 2, 72, 48, 130, 2, 68, 2, 1, 0, 48, 130, 2, 61, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 48, 28, 6, 10, 42, 134, 72, 134, 247, 13, 1, 12, 1, 3, 48, 14, 4, 8, 211, 176, 234, 3, 252, 26, 32, 15, 2, 2, 7, 208, 128, 130, 2, 16, 183, 149, 35, 180, 127, 95, 163, 122, 138, 244, 29, 177, 220, 173, 46, 73, 208, 217, 211, 190, 164, 183, 21, 110, 33, 122, 98, 163, 251, 16, 23, 106, 154, 14, 52, 177, 3, 12, 248, 226, 48, 123, 211, 6, 216, 6, 192, 175, 203, 142, 141, 143, 252, 178, 7, 162, 81, 232, 159, 42, 56, 177, 191, 53, 7, 146, 189, 236, 75, 140, 210, 143, 11, 103, 64, 58, 10, 73, 123, 39, 97, 119, 166, 114, 123, 65, 68, 214, 42, 17, 156, 122, 8, 58, 184, 134, 255, 48, 64, 20, 229, 247, 196, 12, 130, 56, 176, 69, 179, 254, 216, 45, 25, 244, 240, 116, 88, 137, 66, 13, 18, 202, 199, 59, 200, 245, 19, 175, 232, 217, 211, 12, 191, 222, 26, 162, 253, 73, 201, 48, 61, 3, 248, 117, 16, 71, 233, 183, 90, 110, 91, 116, 56, 133, 223, 148, 19, 78, 140, 123, 159, 203, 78, 15, 172, 39, 190, 39, 71, 180, 155, 48, 156, 116, 212, 52, 1, 231, 201, 196, 73, 87, 68, 104, 208, 40, 104, 32, 218, 235, 245, 84, 136, 168, 51, 9, 93, 126, 46, 80, 180, 240, 144, 79, 88, 87, 159, 24, 108, 186, 9, 20, 48, 100, 148, 250, 4, 163, 115, 131, 44, 13, 38, 222, 117, 196, 196, 128, 114, 149, 97, 93, 37, 191, 3, 192, 231, 88, 80, 218, 147, 8, 192, 165, 27, 206, 56, 42, 157, 230, 223, 130, 253, 169, 182, 245, 192, 181, 18, 212, 133, 168, 73, 92, 66, 197, 117, 245, 107, 127, 23, 146, 249, 41, 66, 219, 210, 207, 221, 205, 205, 15, 110, 92, 12, 207, 76, 239, 4, 13, 129, 127, 170, 205, 253, 148, 208, 24, 129, 24, 210, 220, 85, 45, 179, 137, 66, 134, 142, 22, 112, 48, 160, 236, 232, 38, 83, 101, 55, 51, 18, 110, 99, 69, 41, 173, 107, 233, 11, 199, 23, 61, 135, 222, 94, 74, 29, 219, 80, 128, 167, 186, 254, 235, 42, 96, 134, 5, 13, 90, 59, 231, 137, 195, 207, 28, 165, 12, 218, 5, 72, 102, 61, 135, 198, 73, 250, 97, 89, 214, 179, 244, 194, 23, 142, 157, 4, 243, 90, 69, 54, 10, 139, 76, 95, 40, 225, 219, 59, 15, 54, 182, 206, 142, 228, 248, 79, 156, 129, 246, 63, 6, 6, 236, 44, 67, 116, 213, 170, 47, 193, 186, 139, 25, 80, 166, 57, 99, 231, 156, 191, 117, 65, 76, 7, 243, 244, 127, 225, 210, 190, 164, 141, 46, 36, 99, 111, 203, 133, 127, 80, 28, 61, 160, 36, 132, 182, 16, 41, 39, 185, 232, 123, 32, 57, 189, 100, 152, 38, 205, 5, 189, 240, 65, 3, 191, 73, 85, 12, 209, 180, 1, 194, 70, 124, 57, 71, 48, 230, 235, 122, 175, 157, 35, 233, 83, 40, 20, 169, 224, 14, 11, 216, 48, 194, 105, 25, 187, 210, 182, 6, 184, 73, 95, 85, 210, 227, 113, 58, 10, 186, 175, 254, 25, 102, 39, 3, 2, 200, 194, 197, 200, 224, 77, 164, 8, 36, 114, 48, 130, 2, 233, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 160, 130, 2, 218, 4, 130, 2, 214, 48, 130, 2, 210, 48, 130, 2, 206, 6, 11, 42, 134, 72, 134, 247, 13, 1, 12, 10, 1, 2, 160, 130, 2, 166, 48, 130, 2, 162, 48, 28, 6, 10, 42, 134, 72, 134, 247, 13, 1, 12, 1, 3, 48, 14, 4, 8, 178, 13, 52, 135, 85, 49, 79, 105, 2, 2, 7, 208, 4, 130, 2, 128, 21, 84, 227, 109, 230, 144, 140, 170, 117, 250, 179, 207, 129, 100, 126, 126, 29, 231, 94, 140, 45, 26, 168, 45, 240, 4, 170, 73, 98, 115, 109, 96, 177, 206, 6, 80, 170, 22, 237, 144, 58, 95, 59, 26, 85, 135, 178, 69, 184, 44, 122, 81, 213, 135, 149, 198, 246, 83, 68, 129, 2, 186, 118, 33, 44, 214, 227, 240, 220, 51, 175, 220, 220, 180, 113, 216, 101, 138, 81, 54, 38, 0, 216, 30, 29, 187, 213, 230, 12, 181, 130, 21, 241, 98, 120, 41, 150, 176, 69, 37, 169, 249, 123, 212, 254, 135, 154, 214, 127, 39, 105, 149, 180, 218, 41, 207, 75, 70, 105, 169, 185, 169, 132, 173, 188, 82, 251, 71, 234, 136, 5, 254, 110, 223, 34, 4, 145, 7, 19, 51, 123, 140, 75, 226, 0, 21, 220, 228, 223, 218, 8, 169, 210, 194, 139, 93, 218, 55, 40, 174, 50, 238, 38, 166, 222, 103, 0, 209, 88, 131, 51, 222, 154, 217, 18, 172, 73, 17, 133, 54, 173, 208, 118, 104, 167, 113, 153, 223, 251, 154, 120, 176, 18, 127, 51, 206, 164, 77, 86, 9, 82, 212, 86, 162, 206, 230, 79, 217, 178, 42, 217, 162, 152, 188, 217, 59, 212, 117, 200, 135, 75, 74, 43, 1, 42, 79, 180, 164, 250, 122, 103, 103, 157, 11, 14, 33, 48, 8, 108, 155, 46, 124, 223, 204, 169, 124, 104, 11, 246, 213, 226, 16, 125, 17, 228, 15, 178, 141, 79, 78, 115, 76, 131, 122, 166, 124, 154, 1, 174, 178, 176, 213, 208, 188, 71, 118, 220, 168, 64, 218, 176, 134, 38, 229, 14, 109, 162, 125, 16, 57, 249, 201, 180, 17, 182, 143, 184, 12, 248, 113, 65, 70, 109, 79, 249, 34, 170, 35, 228, 219, 121, 202, 228, 121, 127, 255, 22, 173, 202, 171, 33, 232, 4, 240, 142, 216, 80, 56, 177, 83, 93, 123, 217, 213, 157, 99, 34, 194, 61, 228, 239, 194, 20, 27, 9, 53, 132, 79, 19, 97, 107, 31, 51, 39, 176, 223, 90, 88, 67, 138, 194, 169, 176, 144, 202, 119, 146, 74, 27, 118, 63, 129, 230, 101, 104, 75, 116, 49, 223, 254, 225, 70, 206, 183, 11, 134, 148, 10, 55, 57, 50, 178, 144, 164, 139, 233, 169, 109, 186, 211, 95, 123, 75, 111, 192, 187, 127, 240, 45, 226, 194, 240, 128, 10, 79, 178, 192, 66, 21, 197, 24, 171, 141, 255, 185, 230, 84, 206, 151, 9, 93, 115, 162, 12, 115, 129, 218, 103, 219, 183, 142, 123, 3, 110, 139, 208, 4, 146, 76, 99, 246, 240, 32, 169, 148, 16, 146, 172, 230, 36, 56, 145, 23, 94, 209, 92, 38, 244, 127, 70, 121, 253, 66, 55, 36, 140, 98, 105, 233, 112, 24, 23, 230, 112, 62, 244, 12, 48, 30, 51, 0, 18, 244, 139, 66, 245, 234, 203, 195, 52, 119, 255, 84, 82, 204, 100, 176, 167, 24, 224, 8, 127, 214, 148, 115, 242, 56, 190, 72, 221, 68, 252, 36, 74, 254, 57, 52, 96, 20, 173, 32, 236, 87, 15, 16, 76, 9, 48, 3, 61, 2, 137, 137, 9, 68, 213, 99, 163, 63, 201, 83, 241, 98, 7, 117, 108, 4, 123, 170, 18, 10, 19, 198, 31, 170, 15, 247, 216, 145, 172, 239, 137, 181, 80, 160, 24, 11, 35, 131, 58, 218, 22, 250, 215, 52, 160, 246, 197, 183, 92, 137, 0, 245, 63, 49, 183, 246, 195, 58, 63, 4, 75, 10, 92, 131, 181, 59, 78, 247, 44, 150, 49, 49, 107, 211, 62, 71, 62, 222, 159, 161, 118, 236, 55, 219, 49, 0, 3, 82, 236, 96, 20, 83, 39, 245, 208, 240, 245, 174, 218, 49, 21, 48, 19, 6, 9, 42, 134, 72, 134, 247, 13, 1, 9, 21, 49, 6, 4, 4, 1, 0, 0, 0, 48, 61, 48, 33, 48, 9, 6, 5, 43, 14, 3, 2, 26, 5, 0, 4, 20, 30, 154, 48, 126, 198, 239, 114, 62, 12, 58, 129, 172, 67, 156, 76, 214, 62, 205, 89, 28, 4, 20, 135, 177, 105, 83, 79, 93, 181, 149, 169, 49, 112, 201, 70, 212, 153, 79, 198, 163, 137, 90, 2, 2, 7, 208 };
}
[Test] //bug https://bugzilla.novell.com/show_bug.cgi?id=457120
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AuthenticateClientAndServer_ClientSendsNoData ()
{
AuthenticateClientAndServer (true, true);
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class NetworkStreamTest
{
[Test]
// See bug #371923
+
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException(typeof(IOException))]
+#endif
public void NetworkStreamConnection ()
{
IPEndPoint ipe = new IPEndPoint(Dns.GetHostEntry ("www.google.com").AddressList [0], 80);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReadTimeout ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class SocketAcceptAsyncTest
{
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AcceptAsyncShouldUseAcceptSocketFromEventArgs()
{
var readyEvent = new ManualResetEvent(false);
var serverSocket = new Socket(
AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Socket acceptedSocket = null;
-
+ Exception ex = null;
ThreadPool.QueueUserWorkItem(_ =>
{
- listenSocket.Bind(new IPEndPoint(IPAddress.Loopback, 0));
- listenSocket.Listen(1);
-
- var asyncEventArgs = new SocketAsyncEventArgs {AcceptSocket = serverSocket};
- asyncEventArgs.Completed += (s, e) =>
- {
- acceptedSocket = e.AcceptSocket;
- mainEvent.Set();
- };
+ SocketAsyncEventArgs asyncEventArgs;
+ try {
+ listenSocket.Bind(new IPEndPoint(IPAddress.Loopback, 0));
+ listenSocket.Listen(1);
- readyEvent.Set();
+ asyncEventArgs = new SocketAsyncEventArgs {AcceptSocket = serverSocket};
+ asyncEventArgs.Completed += (s, e) =>
+ {
+ acceptedSocket = e.AcceptSocket;
+ mainEvent.Set();
+ };
- if (listenSocket.AcceptAsync(asyncEventArgs))
+ } catch (Exception e) {
+ ex = e;
return;
- acceptedSocket = asyncEventArgs.AcceptSocket;
- mainEvent.Set();
+ } finally {
+ readyEvent.Set();
+ }
+
+ try {
+ if (listenSocket.AcceptAsync(asyncEventArgs))
+ return;
+ acceptedSocket = asyncEventArgs.AcceptSocket;
+ } catch (Exception e) {
+ ex = e;
+ } finally {
+ mainEvent.Set();
+ }
});
Assert.IsTrue(readyEvent.WaitOne(1500));
+ if (ex != null)
+ throw ex;
var clientSocket = new Socket(
AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class SocketAsyncTest
{
Socket serverSocket;
ManualResetEvent mainEvent;
Exception error;
- [TestFixtureSetUp]
- public void SetUp ()
+ void SetUp ()
{
readyEvent = new ManualResetEvent (false);
mainEvent = new ManualResetEvent (false);
ThreadPool.QueueUserWorkItem (_ => DoWork ());
readyEvent.WaitOne ();
+ if (error != null)
+ throw error;
+
clientSocket = new Socket (
AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
clientSocket.Connect (serverSocket.LocalEndPoint);
void DoWork ()
{
- serverSocket = new Socket (
- AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- serverSocket.Bind (new IPEndPoint (IPAddress.Loopback, 0));
- serverSocket.Listen (1);
-
- var async = new SocketAsyncEventArgs ();
- async.Completed += (s,e) => OnAccepted (e);
-
- readyEvent.Set ();
-
- if (!serverSocket.AcceptAsync (async))
- OnAccepted (async);
+ try {
+ serverSocket = new Socket (
+ AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ serverSocket.Bind (new IPEndPoint (IPAddress.Loopback, 0));
+ serverSocket.Listen (1);
+
+ var async = new SocketAsyncEventArgs ();
+ async.Completed += (s,e) => OnAccepted (e);
+
+ if (!serverSocket.AcceptAsync (async))
+ OnAccepted (async);
+ } catch (Exception e) {
+ error = e;
+ } finally {
+ readyEvent.Set ();
+ }
}
void OnAccepted (SocketAsyncEventArgs e)
[Test]
[Category("Test")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SendAsync ()
{
+ SetUp ();
var buffer = new byte [] { 0x12, 0x34, 0x56, 0x78 };
var m = new ManualResetEvent (false);
var e = new SocketAsyncEventArgs ();
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class SocketTest
{
// note: also used in SocketCas tests
public const int BogusPort = 23483;
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectIPAddressAny ()
{
IPEndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
[Test]
[Category ("InetAccess")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BogusEndConnect ()
{
IPAddress ipOne = IPAddress.Parse (BogusAddress);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AcceptBlockingStatus()
{
bool block;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectFailAsync ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SetSocketOptionBoolean ()
{
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
}
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestSelect1 ()
{
Socket srv = CreateServer (NetworkHelpers.FindFreePort ());
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void Disposed19 ()
{
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void Disposed20 ()
{
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void Disposed21 ()
{
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void Disposed22 ()
{
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetHashCodeTest ()
{
Socket server = new Socket (AddressFamily.InterNetwork,
}
[Test]
+ [Category ("RequiresBSDSockets")] // This verifies particular error codes, which we don't care about when nothing's working anyway.
public void SocketErrorTest ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void IsBoundTcp ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void IsBoundUdp ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof(InvalidOperationException))]
+#endif
public void BeginAcceptNotListening ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginAccept ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginAcceptData ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginAcceptSocketUdp ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginAcceptSocketBound ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginAcceptSocket ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginAcceptSocketAccClosed ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginConnectAddressPort ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginConnectAddressPortListen ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginConnectMultiple2 ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginConnectMultipleListen ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginConnectHostPortListen ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
[Test]
[Category ("NotDotNet")] // "Needs XP or later"
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginDisconnect ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BindTwice ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Close ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectAddressPort ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectAddressPortListen ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectMultiple2 ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectMultipleListen ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectHostPortListen ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof(ObjectDisposedException))]
+#endif
public void ConnectHostPortClosed ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
[Test]
[Category ("NotDotNet")] // "Needs XP or later"
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Disconnect ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveGeneric ()
{
int i;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SendGeneric ()
{
int i;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CloseWhileReceiving ()
{
CWRSocket = new Socket (AddressFamily.InterNetwork,
}
[Test] // ReceiveFrom (Byte [], ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveFrom1_Buffer_Null ()
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
}
[Test] // ReceiveFrom (Byte [], ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveFrom1_Socket_Closed ()
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
}
[Test] // ReceiveFrom (Byte [], SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveFrom2_Buffer_Null ()
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
}
[Test] // ReceiveFrom (Byte [], SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveFrom2_Socket_Closed ()
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
}
[Test] // ReceiveFrom (Byte [], Int32, SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveFrom3_Buffer_Null ()
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
}
[Test] // ReceiveFrom (Byte [], Int32, SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveFrom3_Size_OutOfRange ()
{
Socket s;
}
[Test] // ReceiveFrom (Byte [], Int32, SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveFrom3_Socket_Closed ()
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
}
[Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveFrom4_Buffer_Null ()
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
}
[Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveFrom4_Offset_OutOfRange ()
{
Socket s;
}
[Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveFrom4_Size_OutOfRange ()
{
Socket s;
}
[Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, ref EndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveFrom4_Socket_Closed ()
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveRemoteClosed ()
{
var port = NetworkHelpers.FindFreePort ();
//
// Test case for bug #471580
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UdpDoubleBind ()
{
using (Socket s = new Socket (AddressFamily.InterNetwork,
// Test case for bug #31557
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TcpDoubleBind ()
{
using (Socket s = new Socket (AddressFamily.InterNetwork,
}
[Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SetSocketOption3_AddMembershipIPv4_IPv6MulticastOption ()
{
IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
}
[Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SetSocketOption3_AddMembershipIPv4_MulticastOption ()
{
IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
}
[Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SetSocketOption3_AddMembershipIPv6_IPv6MulticastOption ()
{
if (!Socket.OSSupportsIPv6)
}
[Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SetSocketOption3_AddMembershipIPv6_MulticastOption ()
{
if (!Socket.OSSupportsIPv6)
}
[Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SetSocketOption3_DropMembershipIPv4_IPv6MulticastOption ()
{
IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
}
[Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SetSocketOption3_DropMembershipIPv4_MulticastOption ()
{
IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
}
[Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SetSocketOption3_DropMembershipIPv6_IPv6MulticastOption ()
{
if (!Socket.OSSupportsIPv6)
}
[Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SetSocketOption3_DropMembershipIPv6_MulticastOption ()
{
if (!Socket.OSSupportsIPv6)
}
[Test]
+ [Category ("RequiresBSDSockets")] // on watchOS device this happens: System.Net.Sockets.SocketException : The requested address is not valid in this context. This situation is too complex to detect and throw a PlatformNotSupportedException, so just ignore it.
public void SetSocketOption_MulticastInterfaceIndex_Any ()
{
IPAddress ip = IPAddress.Parse ("239.255.255.250");
}
[Test]
+ [Category ("RequiresBSDSockets")] // on watchOS device this happens: System.Net.Sockets.SocketException : The requested address is not valid in this context. This situation is too complex to detect and throw a PlatformNotSupportedException, so just ignore it.
public void SetSocketOption_MulticastInterfaceIndex_Loopback ()
{
IPAddress ip = IPAddress.Parse ("239.255.255.250");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Shutdown_NoConnect ()
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SendAsyncFile ()
{
Socket serverSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectToIPV4EndPointUsingDualModelSocket () {
/*
* IPv6 DualMode sockets are defaults in Mono. Explicitly specify that
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginConnectToIPV4EndPointUsingDualModelSocket () {
/*
* IPv6 DualMode sockets are defaults in Mono. Explicitly specify that
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UdpMulticasTimeToLive ()
{
/* see https://bugzilla.xamarin.com/show_bug.cgi?id=36941 */
/// Tests System.Net.Sockets.TcpClient
/// </summary>
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class TcpClientTest
{
/// (from System.Net.Sockets)
/// </summary>
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TcpClient()
{
// set up a listening Socket
}
[Test] // bug #81105
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CloseTest ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof(ArgumentNullException))]
+#endif
public void ConnectMultiNull ()
{
TcpClient client = new TcpClient ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectMultiAny ()
{
TcpClient client = new TcpClient ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectMultiRefused ()
{
TcpClient client = new TcpClient ();
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class TcpListenerTest
{
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TcpListener ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CtorInt1 ()
{
int nex = 0;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentNullException))]
+#endif
public void CtorIPEndPoint ()
{
new TcpListener (null);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentNullException))]
+#endif
public void CtorIPAddressInt1 ()
{
new TcpListener (null, 100000);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentOutOfRangeException))]
+#endif
public void CtorIPAddressInt2 ()
{
new TcpListener (IPAddress.Any, 100000);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PreStartStatus ()
{
MyListener listener = new MyListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PostStartStatus ()
{
MyListener listener = new MyListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void StartListenMoreThan5 ()
{
var port = NetworkHelpers.FindFreePort ();
namespace MonoTests.System.Net.Sockets {
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class UdpClientTest {
[Test] // .ctor ()
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor1 ()
{
MyUdpClient client;
}
[Test] // .ctor (AddressFamily)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor2 ()
{
MyUdpClient client;
}
[Test] // .ctor (AddressFamily)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor2_Family_Invalid ()
{
try {
}
[Test] // .ctor (Int32)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor3 ()
{
Socket s;
}
[Test] // .ctor (Int32)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor3_Port_OutOfRange ()
{
try {
}
[Test] // .ctor (IPEndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor4 ()
{
Socket s;
}
[Test] // .ctor (IPEndPoint)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor4_LocalEP_Null ()
{
try {
}
[Test] // .ctor (Int32, AddressFamily)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor5 ()
{
Socket s;
}
[Test] // .ctor (Int32, AddressFamily)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor5_Family_Invalid ()
{
try {
}
[Test] // .ctor (Int32, AddressFamily)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor5_Port_OutOfRange ()
{
try {
}
[Test] // .ctor (String, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor6 ()
{
Socket s;
}
[Test] // .ctor (String, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor6_HostName_Null ()
{
try {
}
[Test] // .ctor (String, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Constructor6_Port_OutOfRange ()
{
try {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UdpClientBroadcastTest ()
{
UdpClient client = new UdpClient ();
}
[Test] // JoinMulticastGroup (IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup1_IPv4 ()
{
IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
}
[Test] // JoinMulticastGroup (IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup1_IPv6 ()
{
if (!Socket.OSSupportsIPv6)
}
[Test] // JoinMulticastGroup (IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup1_MulticastAddr_Null ()
{
using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) {
}
[Test] // JoinMulticastGroup (IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup1_Socket_Closed ()
{
IPAddress mcast_addr = null;
}
[Test] // JoinMulticastGroup (In32, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup2_IPv4 ()
{
IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
}
[Test] // JoinMulticastGroup (In32, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup2_IPv6 ()
{
if (!Socket.OSSupportsIPv6)
}
[Test] // JoinMulticastGroup (Int32, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup2_MulticastAddr_Null ()
{
using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) {
}
[Test] // JoinMulticastGroup (Int32, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup2_Socket_Closed ()
{
if (!Socket.OSSupportsIPv6)
}
[Test] // JoinMulticastGroup (IPAddress, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup3_IPv4 ()
{
IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
}
[Test] // JoinMulticastGroup (IPAddress, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup3_IPv6 ()
{
if (!Socket.OSSupportsIPv6)
}
[Test] // JoinMulticastGroup (IPAddress, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup3_MulticastAddr_Null ()
{
using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) {
}
[Test] // JoinMulticastGroup (IPAddress, Int32)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup3_Socket_Closed ()
{
IPAddress mcast_addr = null;
}
[Test] // JoinMulticastGroup (IPAddress, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup4_IPv4 ()
{
IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
}
[Test] // JoinMulticastGroup (IPAddress, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup4_IPv6 ()
{
if (!Socket.OSSupportsIPv6)
}
[Test] // JoinMulticastGroup (IPAddress, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup4_LocalAddress_Null ()
{
IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
}
[Test] // JoinMulticastGroup (IPAddress, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup4_MulticastAddr_Null ()
{
using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) {
}
[Test] // JoinMulticastGroup (IPAddress, IPAddress)
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroup4_Socket_Closed ()
{
IPAddress mcast_addr = null;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CloseInReceive ()
{
UdpClient client = null;
// Test for bug 324033
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void JoinMulticastGroupWithLocal ()
{
UdpClient client = new UdpClient (9001);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof(ArgumentNullException))]
+#endif
public void BeginSendNull ()
{
UdpClient client = new UdpClient ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginSend ()
{
UdpClient client = new UdpClient ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginReceive ()
{
UdpClient client = new UdpClient (1237);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Available ()
{
using (UdpClient client = new UdpClient (1238)) {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void EnableBroadcastDefault ()
{
UdpClient client = new UdpClient ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void MulticastLoopbackDefault ()
{
UdpClient client = new UdpClient ();
}
[Test] // #6057
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveIPv6 ()
{
if (!Socket.OSSupportsIPv6)
{
const string EchoServerUrl = "ws://corefx-net.cloudapp.net/WebSocket/EchoWebSocket.ashx";
int Port = NetworkHelpers.FindFreePort ();
- HttpListener listener;
- ClientWebSocket socket;
- MethodInfo headerSetMethod;
-
- [SetUp]
- public void Setup ()
- {
- listener = new HttpListener ();
- listener.Prefixes.Add ("http://localhost:" + Port + "/");
- listener.Start ();
- socket = new ClientWebSocket ();
+ HttpListener _listener;
+ HttpListener listener {
+ get {
+ if (_listener != null)
+ return _listener;
+ var tmp = new HttpListener ();
+ tmp.Prefixes.Add ("http://localhost:" + Port + "/");
+ tmp.Start ();
+ return _listener = tmp;
+ }
}
+ ClientWebSocket _socket;
+ ClientWebSocket socket { get { return _socket ?? (_socket = new ClientWebSocket ()); } }
+ MethodInfo headerSetMethod;
[TearDown]
public void Teardown ()
{
- if (listener != null) {
- listener.Stop ();
- listener = null;
+ if (_listener != null) {
+ _listener.Stop ();
+ _listener = null;
}
- if (socket != null) {
- if (socket.State == WebSocketState.Open)
- socket.CloseAsync (WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).Wait (2000);
- socket.Dispose ();
- socket = null;
+ if (_socket != null) {
+ if (_socket.State == WebSocketState.Open)
+ _socket.CloseAsync (WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).Wait (2000);
+ _socket.Dispose ();
+ _socket = null;
}
}
namespace MonoTests.System.Net
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class CookieParserTest
{
public const string A = "Foo=Bar, expires=World; expires=Sat, 11-Oct-14 22:45:19 GMT, A=B";
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestExpires ()
{
var cookies = DoRequest (A);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestInvalidCookie ()
{
var cookies = DoRequest (B);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestLocalCulture ()
{
var old = Thread.CurrentThread.CurrentCulture;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestMultiple ()
{
var cookies = DoRequest (D);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestMultiple2 ()
{
var cookies = DoRequest (E);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestQuotation ()
{
var cookies = DoRequest (F);
{
Socket socket;
string[] headers;
+ Exception ex;
public Listener (params string[] headers)
{
socket.Bind (new IPEndPoint (IPAddress.Loopback, 0));
socket.Listen (1);
socket.BeginAccept ((result) => {
- var accepted = socket.EndAccept (result);
- HandleRequest (accepted);
+ try {
+ var accepted = socket.EndAccept (result);
+ HandleRequest (accepted);
+ } catch (Exception e) {
+ ex = e;
+ }
}, null);
}
+ void ThrowIfException ()
+ {
+ if (ex != null)
+ throw ex;
+ }
+
public void Dispose ()
{
if (socket != null) {
socket.Close ();
socket = null;
}
+ ThrowIfException ();
}
void HandleRequest (Socket accepted)
}
public EndPoint EndPoint {
- get { return socket.LocalEndPoint; }
+ get {
+ ThrowIfException ();
+ return socket.LocalEndPoint;
+ }
}
public string URI {
- get { return string.Format ("http://{0}/", EndPoint); }
+ get {
+ ThrowIfException ();
+ return string.Format ("http://{0}/", EndPoint);
+ }
}
}
}
namespace MonoTests.System.Net\r
{\r
[TestFixture]\r
- [Category ("RequiresBSDSockets")]\r
public class DnsTest\r
{\r
private String site1Name = "google-public-dns-a.google.com",\r
private uint site1IP = 134744072, site2IP = 134743044; // Big-Endian\r
\r
[Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void AsyncGetHostByName ()\r
{\r
IAsyncResult async = Dns.BeginGetHostByName (site1Name, null, null);\r
}\r
\r
[Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void AsyncGetHostByNameCallback ()\r
{\r
var evt = new ManualResetEvent (false);\r
}\r
\r
[Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void AsyncResolve ()\r
{\r
IAsyncResult async = Dns.BeginResolve (site1Dot, null, null);\r
}\r
\r
[Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void AsyncResolveCallback ()\r
{\r
var evt = new ManualResetEvent (false);\r
}\r
\r
[Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void GetHostByName ()\r
{\r
SubTestGetHostByName (site1Name, site1Dot);\r
}\r
\r
[Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void BeginResolve_HostName_Null ()\r
{\r
try {\r
}\r
\r
[Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void Resolve ()\r
{\r
SubTestResolve (site1Name);\r
}\r
\r
[Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void Resolve_HostName_Null ()\r
{\r
try {\r
}\r
\r
[Test] // BeginGetHostEntry (IPAddress, AsyncCallback, Object)\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void BeginGetHostEntry1_Address_Null ()\r
{\r
try {\r
}\r
\r
[Test] // BeginGetHostEntry (String, AsyncCallback, Object)\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void BeginGetHostEntry2_HostNameOrAddress_Null ()\r
{\r
try {\r
}\r
\r
[Test] // BeginGetHostEntry (String, AsyncCallback, Object)\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void BeginGetHostEntry2_HostNameOrAddress_UnspecifiedAddress ()\r
{\r
// IPv4\r
}\r
\r
[Test] // GetHostEntry (String)\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void GetHostEntry2 ()\r
{\r
Dns.GetHostEntry (site1Name); // hostname\r
namespace MonoTests.System.Net
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class FileWebRequestTest
{
private string _tempDirectory;
namespace MonoTests.System.Net
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class FtpWebRequestTest
{
- FtpWebRequest defaultRequest;
+ FtpWebRequest _defaultRequest;
+ FtpWebRequest defaultRequest {
+ get { return _defaultRequest ?? (_defaultRequest = (FtpWebRequest) WebRequest.Create ("ftp://www.contoso.com")); }
+ }
private string _tempDirectory;
private string _tempFile;
Directory.Delete (_tempDirectory, true);
}
- [TestFixtureSetUp]
- public void Init ()
- {
- defaultRequest = (FtpWebRequest) WebRequest.Create ("ftp://www.contoso.com");
- }
-
[Test]
public void ContentLength ()
{
try {
long l = defaultRequest.ContentLength;
+#if FEATURE_NO_BSD_SOCKETS
+ Assert.Fail ("#1a");
+ } catch (PlatformNotSupportedException) {
+ // OK.
+#else
} catch (NotSupportedException) {
Assert.Fail ("#1"); // Not overriden
+#endif
}
try {
defaultRequest.ContentLength = 2;
+#if FEATURE_NO_BSD_SOCKETS
+ Assert.Fail ("#2a");
+ } catch (PlatformNotSupportedException) {
+ // OK.
+#else
} catch (NotSupportedException) {
Assert.Fail ("#2"); // Not overriden
+#endif
}
}
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ContentOffset ()
{
try {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Credentials ()
{
try {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Method ()
{
try {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReadWriteTimeout ()
{
try {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Timeout ()
{
try {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void DefaultValues ()
{
FtpWebRequest request = (FtpWebRequest) WebRequest.Create ("ftp://www.contoso.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void RenameTo ()
{
try {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UploadFile1 ()
{
ServerPut sp = new ServerPut ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UploadFile_WebClient ()
{
ServerPut sp = new ServerPut ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void DownloadFile1 ()
{
DownloadFile (new ServerDownload ());
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void DownloadFile2 ()
{
// Some embedded FTP servers in Industrial Automation Hardware report
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void DeleteFile1 ()
{
ServerDeleteFile sp = new ServerDeleteFile ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ListDirectory1 ()
{
ServerListDirectory sp = new ServerListDirectory ();
namespace MonoTests.System.Net {
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class HttpListener2Test {
private HttpListener _listener = null;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test1 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test2 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test3 ()
{
StringBuilder bad = new StringBuilder ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test4 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test5 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test6 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test7 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test8 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test9 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test10 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test11 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test12 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test13 ()
{
var port = NetworkHelpers.FindFreePort ();
ManualResetEvent test_evt;
bool test14_error;
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test14 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test15 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test16 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test17 ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test_MultipleClosesOnOuputStreamAllowed ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReceiveCookiesFromClient ()
{
sendCookiePort = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void SendCookiestoClient ()
{
receiveCookiePort = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void MultiResponses ()
{
echoServerPort = NetworkHelpers.FindFreePort ();
}
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class HttpListenerBugs {
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestNonChunkedAsync ()
{
var port = NetworkHelpers.FindFreePort ();
// a documented pattern to close the connection
//
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test_MultipleConnections ()
{
var port = NetworkHelpers.FindFreePort ();
// Test case for bug 341443, an pretty old bug, filed on November of 2007.
//
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test_HostInUri ()
{
var wait = new ManualResetEvent (false);
}
[Test] // bug #513849
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ClosePort ()
{
var port = NetworkHelpers.FindFreePort ();
// does not also listen to another interface.
//
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BindToSingleInterface ()
{
IPAddress [] machineAddress = null;
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BindToAllInterfaces ()
{
var h = new HttpListener ();
// Test case for bug #31209
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Test_EmptyLineAtStart ()
{
var port = NetworkHelpers.FindFreePort ();
public class HttpListenerPrefixCollectionTest {
// NL -> Not listening -> tests when listener.IsListening == false
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NL_DefaultProperties ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void DefaultProperties ()
{
HttpListener listener = new HttpListener ();
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AddOne ()
{
HttpListener listener = new HttpListener ();
}
[Test]
- [Category ("RequiresBSDSockets")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Duplicate ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void EndsWithSlash ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void DifferentPath ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NL_Clear ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NL_Remove ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NL_RemoveBadUri ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentException))]
+#endif
public void NL_AddBadUri ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentException))]
+#endif
public void NoHostInUrl ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void MultipleSlashes ()
{
// this one throws on Start(), not when adding it.
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PercentSign ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Disposed1 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void Disposed2 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void Disposed3 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void Disposed4 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void Disposed5 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Disposed6 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Disposed7 ()
{
HttpListener listener = new HttpListener ();
namespace MonoTests.System.Net
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class HttpListenerRequestTest
{
[Test]
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void HttpMethod ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void HttpBasicAuthScheme ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void HttpRequestUriIsNotDecoded ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void HttpRequestIsLocal ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test] // #29927
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void HttpRequestUriUnescape ()
{
var prefix = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
namespace MonoTests.System.Net {
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class HttpListenerTest {
- int port;
-
- [SetUp]
- public void SetUp () {
- port = NetworkHelpers.FindFreePort ();
+ int? _port;
+ int port {
+ get { return _port ?? (_port = NetworkHelpers.FindFreePort ()).Value; }
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void DefaultProperties ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Start1 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Stop1 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (InvalidOperationException))]
+#endif
public void GetContext1 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (InvalidOperationException))]
+#endif
public void GetContext2 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (InvalidOperationException))]
+#endif
public void BeginGetContext1 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetContext2 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void DefaultHttpPort ()
{
if (!CanOpenPort (80))
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void DefaultHttpsPort ()
{
if (!CanOpenPort (443))
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TwoListeners_SameAddress ()
{
if (!CanOpenPort (port))
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (HttpListenerException))]
+#endif
public void TwoListeners_SameURL ()
{
if (!CanOpenPort (port))
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (HttpListenerException))]
+#endif
public void MultipleSlashes ()
{
if (!CanOpenPort (port))
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (HttpListenerException))]
+#endif
public void PercentSign ()
{
if (!CanOpenPort (port))
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CloseBeforeStart ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CloseTwice ()
{
if (!CanOpenPort (port))
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void StartStopStart ()
{
if (!CanOpenPort (port))
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void StartStopDispose ()
{
if (!CanOpenPort (port))
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AbortBeforeStart ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AbortTwice ()
{
if (!CanOpenPort (port))
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PropertiesWhenClosed1 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void PropertiesWhenClosed2 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void PropertiesWhenClosedSet1 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void PropertiesWhenClosedSet2 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void PropertiesWhenClosedSet3 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void PropertiesWhenClosedSet4 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ObjectDisposedException))]
+#endif
public void PropertiesWhenClosedSet5 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PropertiesWhenClosed3 ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CloseWhileBegin ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AbortWhileBegin ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (HttpListenerException))]
+#endif
public void CloseWhileGet ()
{
// "System.Net.HttpListener Exception : The I/O operation has been aborted
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (HttpListenerException))]
+#endif
public void AbortWhileGet ()
{
// "System.Net.HttpListener Exception : The I/O operation has been aborted
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ConnectionReuse ()
{
var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UserHeaderWithDoubleMultiValue ()
{
string uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void HttpClientIsDisconnectedCheckForWriteException()
{
string uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
namespace MonoTests.System.Net
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class HttpWebRequestTest
{
private Random rand = new Random ();
[TestFixtureSetUp]
public void Setup ()
{
+#if !FEATURE_NO_BSD_SOCKETS
ServicePointManager.Expect100Continue = false;
+#endif
rand.NextBytes (data64KB);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Proxy_Null ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
[Test]
[Category("InetAccess")]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Sync ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AddRange ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
}
[Test] // bug #471782
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CloseRequestStreamAfterReadingResponse ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
#endif
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Missing_ContentEncoding ()
{
ServicePointManager.CertificatePolicy = new AcceptAllPolicy ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BadServer_ChunkedClose ()
{
// The server will send a chunked response without a 'last-chunked' mark
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStream_Body_NotAllowed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #465613
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStream_NoBuffering ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStream_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetResponse_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void EndGetRequestStream_AsyncResult_Null ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void EndGetResponse_AsyncResult_Null ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #429200
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetRequestStream ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetRequestStream_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #511851
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetResponse_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #324300
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AllowAutoRedirect ()
{
IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PostAndRedirect_NoCL ()
{
IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PostAndRedirect_CL ()
{
IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PostAnd401 ()
{
IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #513087
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NonStandardVerb ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
internal void LaunchWebRequest ()
{
- var req = (HttpWebRequest) WebRequest.Create (url_to_test);
- req.Timeout = TimeOutInMilliSeconds;
-
- Start = DateTime.Now;
try {
+ var req = (HttpWebRequest) WebRequest.Create (url_to_test);
+ req.Timeout = TimeOutInMilliSeconds;
+
+ Start = DateTime.Now;
using (var resp = (HttpWebResponse) req.GetResponse ())
{
var sr = new StreamReader (resp.GetResponseStream (), Encoding.UTF8);
}
[Test] // 1st possible case of https://bugzilla.novell.com/show_bug.cgi?id=MONO74177
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestTimeoutPropertyWithServerThatExistsAndRespondsButTooLate ()
{
var ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // 2nd possible case of https://bugzilla.novell.com/show_bug.cgi?id=MONO74177
+ [Category ("RequiresBSDSockets")] // Requires some test refactoring to assert that a PlatformNotSupportedException is thrown, so don't bother (there's plenty of other tests asserting the PlatformNotSupported exceptions).
public void TestTimeoutWithEndpointThatDoesntExistThrowsConnectFailureBeforeTimeout ()
{
string url = "http://127.0.0.1:8271/"; // some endpoint that is unlikely to exist
return Encoding.UTF8.GetBytes (sw.ToString ());
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NtlmAuthentication ()
{
NtlmServer server = new NtlmServer ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStream ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStreamNoClose ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetRequestStreamCancelIfNotAllBytesWritten ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetRequestStream2 ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetRequestStreamNotAllBytesWritten ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetRequestStreamTimeout ()
{
this.DoRequest (
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginWrite ()
{
byte[] received = new byte[data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginWriteAfterAbort ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PrematureStreamCloseAborts ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write ()
{
byte [] received = new byte [data64KB.Length];
**/
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Read ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReadTimeout2 ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReadServerAborted ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetResponse2 ()
{
byte [] received = new byte [data64KB.Length];
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginGetResponseAborts ()
{
ManualResetEvent aborted = new ManualResetEvent(false);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void TestLargeDataReading ()
{
int near2GBStartPosition = rand.Next (int.MaxValue - 500, int.MaxValue);
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentNullException))]
+#endif
public void NullHost ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NoHost ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentException))]
+#endif
public void EmptyHost ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void HostAndPort ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com:80");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void PortRange ()
{
for (int i = 0; i < 65536; i++) {
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentException))]
+#endif
public void PortBelow ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentException))]
+#endif
public void PortAbove ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#else
[ExpectedException (typeof (ArgumentException))]
+#endif
public void HostTooLong ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void NoDate ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UtcDate ()
{
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com");
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AddAndRemoveDate ()
{
// Neil Armstrong set his foot on Moon
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
// Bug #12393
public void TestIPv6Host ()
{
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AllowReadStreamBuffering ()
{
var hr = WebRequest.CreateHttp ("http://www.google.com");
#endif
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CookieContainerTest ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class HttpRequestStreamTest
{
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginRead ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CanRead ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CanSeek ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test] // bug #324182
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CanTimeout ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CanWrite ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Read ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReadByte ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReadTimeout ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Seek ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Buffer_Null ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Count_Negative ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Count_Overflow ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Offset_Negative ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Offset_Overflow ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void WriteByte_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void WriteTimeout ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
// Bug6737
// This test is supposed to fail prior to .NET 4.0
public void Post_EmptyRequestStream ()
namespace MonoTests.System.Net
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class HttpWebResponseTest
{
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CharacterSet_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Close_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ContentEncoding_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ContentLength_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ContentType_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Cookies_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetResponseHeader_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void GetResponseStream_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Headers_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void LastModified_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Method_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ProtocolVersion_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ResponseUri_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Server_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void StatusCode_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void StatusDescription_Disposed ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class HttpResponseStreamTest
{
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginRead_Buffer_Null ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void BeginWrite ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CanSeek ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test] // bug #324182
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CanTimeout ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void CanWrite ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Read ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Read_Buffer_Null ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Read_Count_Negative ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Read_Count_Overflow ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Read_Offset_Negative ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Read_Offset_Overflow ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void ReadTimeout ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void Write ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void WriteTimeout ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
using System.Collections;\r
using System.IO;\r
using System.Net;\r
-using System.Reflection;
+using System.Reflection;\r
using System.Threading;\r
\r
namespace MonoTests.System.Net\r
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");\r
HttpWebResponse res = (HttpWebResponse) req.GetResponse (); \r
\r
-#if FOUND_SOME_OTHER_URL
- // URL is no longer found, disabled the test until a more reliable URL is found :P
+#if FOUND_SOME_OTHER_URL\r
+ // URL is no longer found, disabled the test until a more reliable URL is found :P\r
//WriteServicePoint ("google after getting a response", google);\r
ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html"));\r
Assert.AreEqual (google, google2, "#equals");\r
res.Close ();\r
-#endif
+#endif\r
\r
// in both instances property CurrentConnections is 0 according to ms.net.\r
// let's see what it says when we do async operations...\r
//Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
res2.Close ();\r
\r
- ServicePoint sp2;
-#if FOUND_SOME_OTHER_URL
+ ServicePoint sp2;\r
+#if FOUND_SOME_OTHER_URL\r
// unless of course some buffering is taking place.. let's check\r
Uri uri2 = new Uri ("http://freedesktop.org/Software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz");\r
sp2 = ServicePointManager.FindServicePoint (uri2);\r
// and so it shows\r
//Console.WriteLine ("ContentLength: " + res2.ContentLength);\r
res2.Close ();\r
-#endif
+#endif\r
\r
\r
// what's the limit of the cache?\r
\r
[Test]\r
[Category ("InetAccess")]\r
- [Category ("AndroidNotWorking")] // #A1 fails
+ [Category ("AndroidNotWorking")] // #A1 fails\r
public void EndPointBind ()\r
{\r
Uri uri = new Uri ("http://www.go-mono.com/");\r
}\r
\r
[Test] //Covers #19823\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ // This test uses HttpWebRequest\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void CloseConnectionGroupConcurency ()\r
{\r
// Try with multiple service points\r
}\r
}\r
\r
-
- [Test]
- public void DnsRefreshTimeout ()
- {
- const int dnsRefreshTimeout = 2000;
-
- ServicePoint sp;
- IPHostEntry host0, host1, host2;
- Uri uri;
- PropertyInfo hostEntryProperty;
-
- ServicePointManager.DnsRefreshTimeout = dnsRefreshTimeout;
-
- uri = new Uri ("http://localhost/");
- sp = ServicePointManager.FindServicePoint (uri);
-
- hostEntryProperty = typeof (ServicePoint).GetProperty ("HostEntry", BindingFlags.NonPublic | BindingFlags.Instance);
-
- host0 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
- host1 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
-
- Assert.AreSame (host0, host1, "HostEntry should result in the same IPHostEntry object.");
-
- Thread.Sleep (dnsRefreshTimeout * 2);
- host2 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;
-
- Assert.AreNotSame(host0, host2, "HostEntry should result in a new IPHostEntry " +
- "object when DnsRefreshTimeout is reached.");
- }
-
+\r
+ [Test]\r
+ [Category ("RequiresBSDSockets")] // Tests internals, so it doesn't make sense to assert that PlatformNotSupportedExceptions are thrown.\r
+ public void DnsRefreshTimeout ()\r
+ {\r
+ const int dnsRefreshTimeout = 2000;\r
+\r
+ ServicePoint sp;\r
+ IPHostEntry host0, host1, host2;\r
+ Uri uri;\r
+ PropertyInfo hostEntryProperty;\r
+\r
+ ServicePointManager.DnsRefreshTimeout = dnsRefreshTimeout;\r
+\r
+ uri = new Uri ("http://localhost/");\r
+ sp = ServicePointManager.FindServicePoint (uri);\r
+\r
+ hostEntryProperty = typeof (ServicePoint).GetProperty ("HostEntry", BindingFlags.NonPublic | BindingFlags.Instance);\r
+\r
+ host0 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
+ host1 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
+\r
+ Assert.AreSame (host0, host1, "HostEntry should result in the same IPHostEntry object.");\r
+\r
+ Thread.Sleep (dnsRefreshTimeout * 2);\r
+ host2 = hostEntryProperty.GetValue (sp, null) as IPHostEntry;\r
+\r
+ Assert.AreNotSame(host0, host2, "HostEntry should result in a new IPHostEntry " +\r
+ "object when DnsRefreshTimeout is reached.");\r
+ }\r
+\r
// Debug code not used now, but could be useful later\r
/*\r
private void WriteServicePoint (string label, ServicePoint sp)\r
namespace MonoTests.System.Net
{
[TestFixture]
- [Category ("RequiresBSDSockets")]
public class WebClientTest
{
private string _tempFolder;
[Test]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UploadValues1 ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ // We throw a PlatformNotSupportedException deeper, which is caught and re-thrown as WebException
+ [ExpectedException (typeof (WebException))]
+#endif
public void GetWebRequestOverriding ()
{
GetWebRequestOverridingTestClass testObject = new GetWebRequestOverridingTestClass ();
[Test]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UploadStringAsyncCancelEvent ()
{
UploadAsyncCancelEventTest (9301, (webClient, uri, cancelEvent) =>
[Test]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UploadDataAsyncCancelEvent ()
{
UploadAsyncCancelEventTest (9302, (webClient, uri, cancelEvent) =>
[Test]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UploadValuesAsyncCancelEvent ()
{
UploadAsyncCancelEventTest (9303, (webClient, uri, cancelEvent) =>
[Test]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UploadFileAsyncCancelEvent ()
{
UploadAsyncCancelEventTest (9304,(webClient, uri, cancelEvent) =>
[Test]
[Category ("AndroidNotWorking")] // Test suite hangs if the tests runs as part of the entire BCL suite. Works when only this fixture is ran
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void UploadFileAsyncContentType ()
{
var port = NetworkHelpers.FindFreePort ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void AddRestricted ()
{
col = CreateRestrictedHeaders ();
}
[Test]
+#if FEATURE_NO_BSD_SOCKETS
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
public void RemoveRestricted ()
{
col = CreateRestrictedHeaders ();
//\r
\r
using NUnit.Framework;\r
-using MonoTests.Helpers;
+using MonoTests.Helpers;\r
using System;\r
using System.Net;\r
-using System.Threading;
+using System.Threading;\r
using System.Collections;\r
using System.Runtime.Serialization;\r
using Socks = System.Net.Sockets;\r
}\r
\r
[Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void All ()\r
{\r
WebRequest req = WebRequest.Create ("http://www.contoso.com");\r
}\r
\r
[Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
public void DefaultWebProxy ()\r
{\r
WebProxy proxy = new WebProxy ("proxy.intern.com", 83);\r
}\r
\r
[Test] //BNC#323452\r
- // Throws exception with Status == Timeout. The same code behaves as the test expects when run from a regular app.
- // Might be an issue with the test suite. To investigate.
- [Category("AndroidNotWorking")]
+ // Throws exception with Status == Timeout. The same code behaves as the test expects when run from a regular app.\r
+ // Might be an issue with the test suite. To investigate.\r
+ [Category("AndroidNotWorking")] \r
public void TestFailedConnection ()\r
{\r
try {\r
WebRequest.Create ("http://127.0.0.1:0/non-existant.txt").GetResponse ();\r
Assert.Fail ("Should have raised an exception");\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ } catch (PlatformNotSupportedException) {\r
+ // Expected\r
+#endif\r
} catch (Exception e) {\r
Assert.IsTrue (e is WebException, "Got " + e.GetType ().Name + ": " + e.Message);\r
//#if NET_2_0 e.Message == "Unable to connect to the remote server"\r
}\r
\r
[Test] //BNC#323452\r
- [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
+ [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran\r
public void TestFailedResolution ()\r
{\r
try {\r
Assert.Ignore ("Misbehaving DNS server.");\r
\r
Assert.Fail ("Should have raised an exception");\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ } catch (PlatformNotSupportedException) {\r
+ // Expected\r
+#endif\r
} catch (Exception e) {\r
Assert.IsTrue (e is WebException);\r
//#if NET_2_0 e.Message == "The underlying connection was closed: The remote name could not be resolved."\r
{\r
internal TestWebRequest3 () { }\r
}\r
-
- [Test] // Covers #41477
- [Category ("RequiresBSDSockets")]
- public void TestReceiveCancelation ()
- {
- var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
-
- HttpListener listener = new HttpListener ();
- listener.Prefixes.Add (uri);
- listener.Start ();
-
- try {
- for (var i = 0; i < 10; i++) {
- var request = WebRequest.CreateHttp (uri);
- request.Method = "GET";
-
- var tokenSource = new CancellationTokenSource ();
- tokenSource.Token.Register(() => request.Abort ());
-
- var responseTask = request.GetResponseAsync ();
-
- var context = listener.GetContext ();
- byte[] outBuffer = new byte[8 * 1024];
- context.Response.OutputStream.WriteAsync (outBuffer, 0, outBuffer.Length);
-
- Assert.IsTrue (responseTask.Wait (1000), "Timeout #1");
-
- WebResponse response = responseTask.Result;
- var stream = response.GetResponseStream ();
-
- byte[] buffer = new byte[8 * 1024];
- var taskRead = stream.ReadAsync (buffer, 0, buffer.Length, tokenSource.Token);
-
- tokenSource.Cancel ();
-
- Assert.IsTrue (taskRead.Wait (1000), "Timeout #2");
-
- var byteRead = taskRead.Result;
- }
- } catch (AggregateException ex) {
- var webEx = ex.InnerException as WebException;
- Assert.IsNotNull(webEx, "Inner exception is not a WebException");
- Assert.AreEqual (webEx.Status, WebExceptionStatus.RequestCanceled);
- }
-
- listener.Close ();
- }
+\r
+ [Test] // Covers #41477\r
+#if FEATURE_NO_BSD_SOCKETS\r
+ [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+ public void TestReceiveCancelation ()\r
+ {\r
+ var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";\r
+\r
+ HttpListener listener = new HttpListener ();\r
+ listener.Prefixes.Add (uri);\r
+ listener.Start ();\r
+\r
+ try {\r
+ for (var i = 0; i < 10; i++) {\r
+ var request = WebRequest.CreateHttp (uri);\r
+ request.Method = "GET";\r
+\r
+ var tokenSource = new CancellationTokenSource ();\r
+ tokenSource.Token.Register(() => request.Abort ());\r
+\r
+ var responseTask = request.GetResponseAsync ();\r
+\r
+ var context = listener.GetContext ();\r
+ byte[] outBuffer = new byte[8 * 1024];\r
+ context.Response.OutputStream.WriteAsync (outBuffer, 0, outBuffer.Length);\r
+\r
+ Assert.IsTrue (responseTask.Wait (1000), "Timeout #1");\r
+\r
+ WebResponse response = responseTask.Result;\r
+ var stream = response.GetResponseStream ();\r
+\r
+ byte[] buffer = new byte[8 * 1024];\r
+ var taskRead = stream.ReadAsync (buffer, 0, buffer.Length, tokenSource.Token);\r
+\r
+ tokenSource.Cancel ();\r
+\r
+ Assert.IsTrue (taskRead.Wait (1000), "Timeout #2");\r
+\r
+ var byteRead = taskRead.Result;\r
+ }\r
+ } catch (AggregateException ex) {\r
+ var webEx = ex.InnerException as WebException;\r
+ Assert.IsNotNull(webEx, "Inner exception is not a WebException");\r
+ Assert.AreEqual (webEx.Status, WebExceptionStatus.RequestCanceled);\r
+ }\r
+\r
+ listener.Close ();\r
+ }\r
}\r
\r
}\r
System.Net/HttpListenerPrefixCollection.cs
System.Net/HttpListenerRequest.cs
System.Net/HttpListenerResponse.cs
+System.Net/HttpListenerResponseHelper.cs
System.Net/HttpListenerTimeoutManager.cs
System.Net/HttpRequestCreator.cs
System.Net/HttpStreamAsyncResult.cs
--- /dev/null
+Mono.Net.Security/LegacySslStream.cs
+Mono.Net.Security/MonoLegacyTlsProvider.cs
+System.Net.Mail/SmtpClient.cs
+System.Net.Sockets/TcpClient.cs
+System.Net.Sockets/TcpListener.cs
+System.Net.Sockets/UdpClient.cs
+System.Net.WebSockets/ClientWebSocket.cs
+System.Net/ChunkedInputStream.cs
+System.Net/EndPointListener.cs
+System.Net/EndPointManager.cs
+System.Net/FtpAsyncResult.cs
+System.Net/FtpDataStream.cs
+System.Net/FtpRequestCreator.cs
+System.Net/FtpRequestCreator.cs
+System.Net/FtpStatus.cs
+System.Net/FtpWebRequest.cs
+System.Net/FtpWebResponse.cs
+System.Net/HttpConnection.cs
+System.Net/HttpListener.cs
+System.Net/HttpListenerContext.cs
+System.Net/HttpListenerPrefixCollection.cs
+System.Net/HttpListenerRequest.cs
+System.Net/HttpListenerResponse.cs
+System.Net/HttpWebRequest.cs
+System.Net/HttpWebResponse.cs
+System.Net/ListenerAsyncResult.cs
+System.Net/ResponseStream.cs
#include monotouch_System.dll.sources
+System.Net.Mail/SmtpClient.platformnotsupported.cs
+System.Net.Sockets/TcpClient.platformnotsupported.cs
+System.Net.Sockets/TcpListener.platformnotsupported.cs
+System.Net.Sockets/UdpClient.platformnotsupported.cs
+System.Net.WebSockets/ClientWebSocket.platformnotsupported.cs
+System.Net/FtpRequestCreator.platformnotsupported.cs
+System.Net/FtpWebRequest.platformnotsupported.cs
+System.Net/FtpWebResponse.platformnotsupported.cs
+System.Net/HttpListener.platformnotsupported.cs
+System.Net/HttpListenerContext.platformnotsupported.cs
+System.Net/HttpListenerPrefixCollection.platformnotsupported.cs
+System.Net/HttpListenerRequest.platformnotsupported.cs
+System.Net/HttpListenerResponse.platformnotsupported.cs
+System.Net/HttpWebRequest.platformnotsupported.cs
+System.Net/HttpWebResponse.platformnotsupported.cs