Exemplo n.º 1
0
        public void Should_properly_resolve_an_ip_address_with_multiple_options()
        {
            var uri = new Uri("http://www.microsoft.com/");

            IPEndPoint[] endpoint = uri.ResolveHostName().ToArray();

            endpoint.Length.ShouldBeGreaterThanOrEqualTo(1);
        }
Exemplo n.º 2
0
        public void Should_properly_resolve_an_ip_address_with_ssl()
        {
            var uri = new Uri("https://www.codebetter.com");

            IPEndPoint endpoint = uri.ResolveHostName().Single();

            endpoint.Address.ShouldEqual(IPAddress.Parse("184.106.69.38"));
            endpoint.Port.ShouldEqual(443);
        }
Exemplo n.º 3
0
        public void Should_properly_resolve_an_ip_address_with_any_local_address()
        {
            var uri = new Uri("bogus://0.0.0.0:8008/");

            IPEndPoint endpoint = uri.ResolveHostName().Single();

            endpoint.Address.ShouldEqual(IPAddress.Any);
            endpoint.Port.ShouldEqual(8008);
        }
Exemplo n.º 4
0
		static IPEndPoint ResolveEndpoint(Uri uri)
		{
			try
			{
				return uri.ResolveHostName().Single();
			}
			catch (Exception ex)
			{
				throw new StreamServerException(
					"{0} resolves to multiple IP addresses, use 0.0.0.0 to bind to all available addresses".FormatWith(uri), ex);
			}
		}