private static IChannel BuildChannel(Uri uri) { if (uri.Scheme == "udp") { var settings = UdpChannelSettings.Parse(uri); return(new UdpChannel(settings)); } string message = $"Expected uri scheme to be either 'udp' or 'tcp' but received '{uri.Scheme}'"; throw new ArgumentException(message, nameof(uri)); }
public void Should_parse_uri_properly() { var uri = new Uri("udp://my-host:8085?prefix=the.service&background=false&ignore_exceptions&dns_update_period=13&ipv6"); var settings = UdpChannelSettings.Parse(uri); var expected = new UdpChannelSettings { Host = "my-host", IgnoreSocketExceptions = true, Port = 8085, DnsUpdatePeriod = 13, AddressFamily = AddressFamily.InterNetworkV6 }; settings.ShouldBeEquivalentTo(expected); }