public void BufferedConnection () { var host = new ServiceHost (typeof (Foo)); var bindingsvc = new CustomBinding (new BinaryMessageEncodingBindingElement (), new TcpTransportBindingElement ()); host.AddServiceEndpoint (typeof (IFoo), bindingsvc, "net.tcp://localhost:37564/"); 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 (); 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); t.Start (); t.Stop (); } Assert.IsTrue (Foo.AddCalled, "#1"); Assert.IsTrue (Foo.JoinCalled, "#2"); }