public void DefaultValues() { TcpTransportBindingElement be = new TcpTransportBindingElement(); Assert.AreEqual(TimeSpan.FromSeconds(5), be.ChannelInitializationTimeout, "#1"); Assert.AreEqual(0x2000, be.ConnectionBufferSize, "#2"); Assert.AreEqual(HostNameComparisonMode.StrongWildcard, be.HostNameComparisonMode, "#3"); Assert.AreEqual(0x10000, be.MaxBufferSize, "#4"); Assert.AreEqual(TimeSpan.FromMilliseconds(200), be.MaxOutputDelay, "#5"); Assert.AreEqual(1, be.MaxPendingAccepts, "#6"); Assert.AreEqual(10, be.MaxPendingConnections, "#7"); Assert.AreEqual(TransferMode.Buffered, be.TransferMode, "#8"); Assert.AreEqual(10, be.ListenBacklog, "#9"); Assert.IsFalse(be.PortSharingEnabled, "#10"); Assert.AreEqual("net.tcp", be.Scheme, "#11"); Assert.IsFalse(be.TeredoEnabled, "#12"); TcpConnectionPoolSettings pool = be.ConnectionPoolSettings; Assert.IsNotNull(pool, "#13"); Assert.AreEqual("default", pool.GroupName, "#14"); Assert.AreEqual(TimeSpan.FromSeconds(120), pool.IdleTimeout, "#15"); Assert.AreEqual(TimeSpan.FromSeconds(300), pool.LeaseTimeout, "#16"); Assert.AreEqual(10, pool.MaxOutboundConnectionsPerEndpoint, "#17"); }
public static void MaxOutboundConnectionsPerEndpoint_Property_Set_Invalid_Value_Throws(int value) { // TcpConnectionPoolSettings has no public constructor but we can access it from the TcpTransportBindingElement TcpTransportBindingElement element = new TcpTransportBindingElement(); TcpConnectionPoolSettings settings = element.ConnectionPoolSettings; Assert.Throws <ArgumentOutOfRangeException>(() => settings.MaxOutboundConnectionsPerEndpoint = value); }
public static void LeaseTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan) { // TcpConnectionPoolSettings has no public constructor but we can access it from the TcpTransportBindingElement TcpTransportBindingElement element = new TcpTransportBindingElement(); TcpConnectionPoolSettings settings = element.ConnectionPoolSettings; Assert.Throws <ArgumentOutOfRangeException>(() => settings.LeaseTimeout = timeSpan); }
public static void GroupName_Property_Set_Null_Value_Throws() { // TcpConnectionPoolSettings has no public constructor but we can access it from the TcpTransportBindingElement TcpTransportBindingElement element = new TcpTransportBindingElement(); TcpConnectionPoolSettings settings = element.ConnectionPoolSettings; Assert.Throws <ArgumentNullException>(() => settings.GroupName = null); }
public static void MaxOutboundConnectionsPerEndpoint_Property_Sets(int value) { // TcpConnectionPoolSettings has no public constructor but we can access it from the TcpTransportBindingElement TcpTransportBindingElement element = new TcpTransportBindingElement(); TcpConnectionPoolSettings settings = element.ConnectionPoolSettings; settings.MaxOutboundConnectionsPerEndpoint = value; Assert.Equal <int>(value, settings.MaxOutboundConnectionsPerEndpoint); }
public static void LeaseTimeout_Property_Sets(TimeSpan timeSpan) { // TcpConnectionPoolSettings has no public constructor but we can access it from the TcpTransportBindingElement TcpTransportBindingElement element = new TcpTransportBindingElement(); TcpConnectionPoolSettings settings = element.ConnectionPoolSettings; settings.LeaseTimeout = timeSpan; Assert.Equal <TimeSpan>(timeSpan, settings.LeaseTimeout); }
public static void GroupName_Property_Sets(string groupName) { // TcpConnectionPoolSettings has no public constructor but we can access it from the TcpTransportBindingElement TcpTransportBindingElement element = new TcpTransportBindingElement(); TcpConnectionPoolSettings settings = element.ConnectionPoolSettings; settings.GroupName = groupName; Assert.Equal(groupName, settings.GroupName); }
internal void InitializeFrom(TcpConnectionPoolSettings settings) { if (settings == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings"); } this.GroupName = settings.GroupName; this.IdleTimeout = settings.IdleTimeout; this.LeaseTimeout = settings.LeaseTimeout; this.MaxOutboundConnectionsPerEndpoint = settings.MaxOutboundConnectionsPerEndpoint; }
internal void ApplyConfiguration(TcpConnectionPoolSettings settings) { if (settings == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings"); } settings.GroupName = this.GroupName; settings.IdleTimeout = this.IdleTimeout; settings.LeaseTimeout = this.LeaseTimeout; settings.MaxOutboundConnectionsPerEndpoint = this.MaxOutboundConnectionsPerEndpoint; }
internal void InitializeFrom(TcpConnectionPoolSettings settings) { if (null == settings) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings"); } SetPropertyValueIfNotDefaultValue(ConfigurationStrings.GroupName, settings.GroupName); SetPropertyValueIfNotDefaultValue(ConfigurationStrings.IdleTimeout, settings.IdleTimeout); SetPropertyValueIfNotDefaultValue(ConfigurationStrings.LeaseTimeout, settings.LeaseTimeout); SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxOutboundConnectionsPerEndpoint, settings.MaxOutboundConnectionsPerEndpoint); }
static void Main() { // <Snippet3> // <Snippet0> // <Snippet1> TcpTransportBindingElement bElement = new TcpTransportBindingElement(); // </Snippet1> TcpConnectionPoolSettings connectionPoolSettings = bElement.ConnectionPoolSettings; // </Snippet0> // </Snippet3> // <Snippet4> int listenBacklog = bElement.ListenBacklog; // </Snippet4> // <Snippet5> bool portSharingEnabled = bElement.PortSharingEnabled; // </Snippet5> // <Snippet6> string scheme = bElement.Scheme; // </Snippet6> // <Snippet7> bool teredoEnabled = bElement.TeredoEnabled; // </Snippet7> // <Snippet8> BindingElement bElementClone = bElement.Clone(); // </Snippet8> // <Snippet11> BasicHttpBinding binding = new BasicHttpBinding(); ISecurityCapabilities b = binding.GetProperty <ISecurityCapabilities> (new BindingParameterCollection()); bool SupportsServerAuthentication = b.SupportsServerAuthentication; // </Snippet11> }
public TcpTransportBindingElement() : base() { _connectionPoolSettings = new TcpConnectionPoolSettings(); }
protected TcpTransportBindingElement(TcpTransportBindingElement elementToBeCloned) : base(elementToBeCloned) { _connectionPoolSettings = elementToBeCloned._connectionPoolSettings.Clone(); }