Merge pull request #1874 from saper/bug_29679
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel.Channels / TcpTransportBindingElement.cs
index 6233b801f3281188b39c291286a26d5e862dfadf..64c3b38a249d89c6383ee8b0e6edc8573ba934e7 100644 (file)
@@ -31,11 +31,11 @@ using System;
 using System.Collections.Generic;
 using System.Net;
 using System.ServiceModel.Channels;
+using System.ServiceModel.Channels.NetTcp;
 using System.ServiceModel.Description;
 
 namespace System.ServiceModel.Channels
 {
-       [MonoTODO]
        public class TcpTransportBindingElement
                : ConnectionOrientedTransportBindingElement
        {
@@ -83,18 +83,20 @@ namespace System.ServiceModel.Channels
                        set { teredo_enabled = value; }
                }
 
-               [MonoTODO]
                public override IChannelFactory<TChannel> BuildChannelFactory<TChannel> (
                        BindingContext context)
                {
+                       if (!CanBuildChannelFactory<TChannel> (context))
+                               throw new InvalidOperationException (String.Format ("Not supported channel factory type '{0}'", typeof (TChannel)));
                        return new TcpChannelFactory<TChannel> (this, context);
                }
 
-               [MonoTODO]
                public override IChannelListener<TChannel>
                        BuildChannelListener<TChannel> (
                        BindingContext context)
                {
+                       if (!CanBuildChannelListener<TChannel> (context))
+                               throw new InvalidOperationException (String.Format ("Not supported channel listener type '{0}'", typeof (TChannel)));
                        return new TcpChannelListener<TChannel> (this, context);
                }
 
@@ -103,11 +105,29 @@ namespace System.ServiceModel.Channels
                        return new TcpTransportBindingElement (this);
                }
 
-               [MonoTODO]
                public override T GetProperty<T> (BindingContext context)
                {
-                       // FIXME: ... or return ISecurityCapabilities?
-                       return context.GetInnerProperty<T> ();
+                       if (typeof (T) == typeof (IBindingDeliveryCapabilities))
+                               return (T) (object) new TcpBindingProperties (this);
+                       return base.GetProperty<T> (context);
+               }
+       }
+
+       class TcpBindingProperties : IBindingDeliveryCapabilities
+       {
+               TcpTransportBindingElement source;
+
+               public TcpBindingProperties (TcpTransportBindingElement source)
+               {
+                       this.source = source;
+               }
+
+               public bool AssuresOrderedDelivery {
+                       get { return true; }
+               }
+
+               public bool QueuedDelivery {
+                       get { return false; }
                }
        }
 }