public Property HeliosTransport_Should_Resolve_DNS_with_PublicHostname(IPEndPoint inbound, DnsEndPoint publicInbound,
                                                                               IPEndPoint outbound, DnsEndPoint publicOutbound, bool dnsUseIpv6)
        {
            if (dnsUseIpv6 &&
                (inbound.AddressFamily == AddressFamily.InterNetwork ||
                 (outbound.AddressFamily == AddressFamily.InterNetwork)))
            {
                return(true.Label("Can't connect to IPV4 socket using IPV6 DNS resolution"));
            }
            if (!dnsUseIpv6 &&
                (inbound.AddressFamily == AddressFamily.InterNetworkV6 ||
                 (outbound.AddressFamily == AddressFamily.InterNetworkV6)))
            {
                return(true.Label("Need to apply DNS resolution and IP stack verison consistently."));
            }

            try
            {
                Setup(EndpointGenerators.ParseAddress(inbound),
                      EndpointGenerators.ParseAddress(outbound),
                      EndpointGenerators.ParseAddress(publicInbound),
                      EndpointGenerators.ParseAddress(publicOutbound), dnsUseIpv6);
                var outboundReceivedAck = true;
                var inboundReceivedAck  = true;
                _outbound.ActorSelection(_inboundAck).Tell("ping", _outboundProbe.Ref);
                try
                {
                    _outboundProbe.ExpectMsg("ack");
                }
                catch
                {
                    outboundReceivedAck = false;
                }

                _inbound.ActorSelection(_outboundAck).Tell("ping", _inboundProbe.Ref);
                try
                {
                    _inboundProbe.ExpectMsg("ack");
                }
                catch
                {
                    inboundReceivedAck = false;
                }


                return(outboundReceivedAck.Label($"Expected (outbound: {RARP.For(_outbound).Provider.DefaultAddress}) to be able to successfully message and receive reply from (inbound: {RARP.For(_inbound).Provider.DefaultAddress})")
                       .And(inboundReceivedAck.Label($"Expected (inbound: {RARP.For(_inbound).Provider.DefaultAddress}) to be able to successfully message and receive reply from (outbound: {RARP.For(_outbound).Provider.DefaultAddress})")));
            }
            finally
            {
                Cleanup();
            }
        }
        public Property HeliosTransport_Should_Resolve_DNS(EndPoint inbound, EndPoint outbound, bool dnsIpv6)
        {
            if (IsAnyIp(inbound) || IsAnyIp(outbound))
            {
                return(true.Label("Can't connect directly to an ANY address"));
            }
            try
            {
                Setup(EndpointGenerators.ParseAddress(inbound), EndpointGenerators.ParseAddress(outbound), useIpv6Dns: dnsIpv6);
                var outboundReceivedAck = true;
                var inboundReceivedAck  = true;
                _outbound.ActorSelection(_inboundAck).Tell("ping", _outboundProbe.Ref);
                try
                {
                    _outboundProbe.ExpectMsg("ack");
                }
                catch
                {
                    outboundReceivedAck = false;
                }

                _inbound.ActorSelection(_outboundAck).Tell("ping", _inboundProbe.Ref);
                try
                {
                    _inboundProbe.ExpectMsg("ack");
                }
                catch
                {
                    inboundReceivedAck = false;
                }


                return(outboundReceivedAck.Label($"Expected (outbound: {RARP.For(_outbound).Provider.DefaultAddress}) to be able to successfully message and receive reply from (inbound: {RARP.For(_inbound).Provider.DefaultAddress})")
                       .And(inboundReceivedAck.Label($"Expected (inbound: {RARP.For(_inbound).Provider.DefaultAddress}) to be able to successfully message and receive reply from (outbound: {RARP.For(_outbound).Provider.DefaultAddress})")));
            }
            finally
            {
                Cleanup();
            }
        }
Example #3
0
        public Property HeliosTransport_Should_Resolve_DNS_with_PublicHostname(IPEndPoint inbound, DnsEndPoint publicInbound,
                                                                               IPEndPoint outbound, DnsEndPoint publicOutbound, bool dnsUseIpv6, bool enforceIpFamily)
        {
            // TODO: Mono does not support IPV6 Uris correctly https://bugzilla.xamarin.com/show_bug.cgi?id=43649 (Aaronontheweb 8/22/2016)
            if (IsMono)
            {
                enforceIpFamily = true;
            }
            if (IsMono && dnsUseIpv6)
            {
                return(true.Label("Mono DNS does not support IPV6 as of 4.4*"));
            }
            if (IsMono &&
                (inbound.AddressFamily == AddressFamily.InterNetworkV6 ||
                 (outbound.AddressFamily == AddressFamily.InterNetworkV6)))
            {
                return(true.Label("Mono DNS does not support IPV6 as of 4.4*"));
            }

            if (dnsUseIpv6 &&
                (inbound.AddressFamily == AddressFamily.InterNetwork ||
                 (outbound.AddressFamily == AddressFamily.InterNetwork)))
            {
                return(true.Label("Can't connect to IPV4 socket using IPV6 DNS resolution"));
            }
            if (!dnsUseIpv6 &&
                (inbound.AddressFamily == AddressFamily.InterNetworkV6 ||
                 (outbound.AddressFamily == AddressFamily.InterNetworkV6)))
            {
                return(true.Label("Need to apply DNS resolution and IP stack verison consistently."));
            }


            try
            {
                try
                {
                    Setup(EndpointGenerators.ParseAddress(inbound),
                          EndpointGenerators.ParseAddress(outbound),
                          EndpointGenerators.ParseAddress(publicInbound),
                          EndpointGenerators.ParseAddress(publicOutbound),
                          dnsUseIpv6,
                          enforceIpFamily);
                }
                catch
                {
                    //if ip family is enforced, there are some special cases when it is normal to unable
                    //to create actor system
                    if (enforceIpFamily && IsExpectedFailure(inbound, outbound, dnsUseIpv6))
                    {
                        return(true.ToProperty());
                    }
                    throw;
                }
                var outboundReceivedAck = true;
                var inboundReceivedAck  = true;
                _outbound.ActorSelection(_inboundAck).Tell("ping", _outboundProbe.Ref);
                try
                {
                    _outboundProbe.ExpectMsg("ack");
                }
                catch
                {
                    outboundReceivedAck = false;
                }

                _inbound.ActorSelection(_outboundAck).Tell("ping", _inboundProbe.Ref);
                try
                {
                    _inboundProbe.ExpectMsg("ack");
                }
                catch
                {
                    inboundReceivedAck = false;
                }


                return(outboundReceivedAck.Label($"Expected (outbound: {RARP.For(_outbound).Provider.DefaultAddress}) to be able to successfully message and receive reply from (inbound: {RARP.For(_inbound).Provider.DefaultAddress})")
                       .And(inboundReceivedAck.Label($"Expected (inbound: {RARP.For(_inbound).Provider.DefaultAddress}) to be able to successfully message and receive reply from (outbound: {RARP.For(_outbound).Provider.DefaultAddress})")));
            }
            finally
            {
                Cleanup();
            }
        }
Example #4
0
        public Property HeliosTransport_Should_Resolve_DNS(EndPoint inbound, EndPoint outbound, bool dnsIpv6, bool enforceIpFamily)
        {
            // TODO: Mono does not support IPV6 Uris correctly https://bugzilla.xamarin.com/show_bug.cgi?id=43649 (Aaronontheweb 8/22/2016)
            if (IsMono)
            {
                enforceIpFamily = true;
                dnsIpv6         = false;
            }


            if (IsAnyIp(inbound) || IsAnyIp(outbound))
            {
                return(true.Label("Can't connect directly to an ANY address"));
            }
            try
            {
                try
                {
                    Setup(EndpointGenerators.ParseAddress(inbound),
                          EndpointGenerators.ParseAddress(outbound),
                          useIpv6Dns: dnsIpv6,
                          enforceIpFamily: enforceIpFamily);
                }
                catch
                {
                    //if ip family is enforced, there are some special cases when it is normal to unable
                    //to create actor system
                    if (enforceIpFamily && IsExpectedFailure(inbound, outbound, dnsIpv6))
                    {
                        return(true.ToProperty());
                    }
                    throw;
                }

                var outboundReceivedAck = true;
                var inboundReceivedAck  = true;
                _outbound.ActorSelection(_inboundAck).Tell("ping", _outboundProbe.Ref);
                try
                {
                    _outboundProbe.ExpectMsg("ack");
                }
                catch
                {
                    outboundReceivedAck = false;
                }

                _inbound.ActorSelection(_outboundAck).Tell("ping", _inboundProbe.Ref);
                try
                {
                    _inboundProbe.ExpectMsg("ack");
                }
                catch
                {
                    inboundReceivedAck = false;
                }

                return(outboundReceivedAck.Label($"Expected (outbound: {RARP.For(_outbound).Provider.DefaultAddress}) to be able to successfully message and receive reply from (inbound: {RARP.For(_inbound).Provider.DefaultAddress})")
                       .And(inboundReceivedAck.Label($"Expected (inbound: {RARP.For(_inbound).Provider.DefaultAddress}) to be able to successfully message and receive reply from (outbound: {RARP.For(_outbound).Provider.DefaultAddress})")));
            }
            finally
            {
                Cleanup();
            }
        }