Beispiel #1
0
        public void TryReplaceHostNameReplacesValidHostNamesAndDoesntThrowOnInvalidInput()
        {
            var url = ServerProtocolSetup.TryReplaceHostName("http://1.2.3.4/5", "newhost");

            Assert.AreEqual("http://newhost/5", url);
            Assert.AreEqual("unsupported", ServerProtocolSetup.TryReplaceHostName("unsupported", "example"));
            Assert.AreEqual(null, ServerProtocolSetup.TryReplaceHostName(null, null));
        }
Beispiel #2
0
        public void GetIpAddressesDoesntReturnLoopbackOrAnyIpAddresses()
        {
            var addresses = ServerProtocolSetup.GetIpAddresses();

            Assert.IsFalse(addresses.Contains(IPAddress.Any));
            Assert.IsFalse(addresses.Contains(IPAddress.IPv6Any));
            Assert.IsFalse(addresses.Contains(IPAddress.Loopback));
            Assert.IsFalse(addresses.Contains(IPAddress.IPv6Loopback));
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            using (var transport = new WcfServerTransportAdapter()
            {
                BaseAddress = "net.tcp://localhost:9091"
            })
            {
                var protocol = ServerProtocolSetup.WithChannel(x => transport);

                using (var host = new ZyanComponentHost("HelloWcf", protocol))
                {
                    host.RegisterComponent <IEchoService, EchoService>();
                    Console.WriteLine("Server läuft!");
                    Console.ReadLine();
                }
            }
        }