Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -35,6 +35,8 @@ using System.ServiceModel.Security;
using System.Threading;
using NUnit.Framework;
using MonoTests.Helpers;
namespace MonoTests.System.ServiceModel
{
[TestFixture]
@@ -167,17 +169,18 @@ namespace MonoTests.System.ServiceModel
{
var host = new ServiceHost (typeof (Foo));
var bindingsvc = new CustomBinding (new BinaryMessageEncodingBindingElement (), new TcpTransportBindingElement ());
host.AddServiceEndpoint (typeof (IFoo), bindingsvc, "net.tcp://localhost:37564/");
int port = NetworkHelpers.FindFreePort ();
host.AddServiceEndpoint (typeof (IFoo), bindingsvc, "net.tcp://localhost:" + port + "/");
host.Open (TimeSpan.FromSeconds (5));
try {
var bindingcli = new NetTcpBinding () { TransactionFlow = false };
bindingcli.Security.Mode = SecurityMode.None;
var cli = new ChannelFactory<IFooClient> (bindingcli, new EndpointAddress ("net.tcp://localhost:37564/")).CreateChannel ();
var cli = new ChannelFactory<IFooClient> (bindingcli, new EndpointAddress ("net.tcp://localhost:" + port + "/")).CreateChannel ();
Assert.AreEqual (5, cli.Add (1, 4));
Assert.AreEqual ("monkey science", cli.Join ("monkey", "science"));
} finally {
host.Close (TimeSpan.FromSeconds (5));
var t = new TcpListener (37564);
var t = new TcpListener (port);
t.Start ();
t.Stop ();
}
@@ -190,18 +193,19 @@ namespace MonoTests.System.ServiceModel
{
var host = new ServiceHost (typeof (Foo));
var bindingsvc = new CustomBinding (new BinaryMessageEncodingBindingElement (), new TcpTransportBindingElement () { TransferMode = TransferMode.Streamed });
host.AddServiceEndpoint (typeof (IFoo), bindingsvc, "net.tcp://localhost:37564/");
int port = NetworkHelpers.FindFreePort ();
host.AddServiceEndpoint (typeof (IFoo), bindingsvc, "net.tcp://localhost:" + port + "/");
host.Open (TimeSpan.FromSeconds (5));
try {
var bindingcli = new NetTcpBinding () { TransactionFlow = false };
bindingcli.TransferMode = TransferMode.Streamed;
bindingcli.Security.Mode = SecurityMode.None;
var cli = new ChannelFactory<IFooClient> (bindingcli, new EndpointAddress ("net.tcp://localhost:37564/")).CreateChannel ();
var cli = new ChannelFactory<IFooClient> (bindingcli, new EndpointAddress ("net.tcp://localhost:" + port + "/")).CreateChannel ();
Assert.AreEqual (5, cli.Add (1, 4));
Assert.AreEqual ("monkey science", cli.Join ("monkey", "science"));
} finally {
host.Close (TimeSpan.FromSeconds (5));
var t = new TcpListener (37564);
var t = new TcpListener (port);
t.Start ();
t.Stop ();
}