@ParameterizedTest
    @ValueSource(booleans = {true, false})
    public void testAllResultsFamilyInterleavedWhenPreferredFamilyProvidedSecondAfterResolutionDelay(final boolean preferIpv4) throws Exception
    {
        // Setup test fixture.
        final List<SrvRecord> input = List.of(HOST_PRIO0, HOST_PRIO1);

        // Execute system under test.
        final HappyEyeballsResolver systemUnderTest = new HappyEyeballsResolver(input, preferIpv4, RESOLUTION_DELAY);
        try {
            systemUnderTest.solve(SOLVER_PRIO0_BOTHFAMS_DELAYED_LONG, 0);
            systemUnderTest.solve(preferIpv4 ? SOLVER_PRIO1_IPV6ONLY : SOLVER_PRIO1_IPV4ONLY, 1);

            final List<ResolvedServiceAddress> results = new LinkedList<>();
            for (int i = 0; i < 10; i++) {
                final ResolvedServiceAddress nextResult = systemUnderTest.getNext();
                if (nextResult != null) {
                    results.add(nextResult);
                }
                if (results.size() == 3) {
                    break;
                }
            }

            // Verify results.
            assertEquals(3, results.size());
            assertEquals(preferIpv4 ? HOST_PRIO1_IPV6_ADDRESS : HOST_PRIO1_IPV4_ADDRESS, results.get(0).getInetAddress());
            assertEquals(preferIpv4 ? HOST_PRIO0_IPV4_ADDRESS : HOST_PRIO0_IPV6_ADDRESS, results.get(1).getInetAddress());
            assertEquals(preferIpv4 ? HOST_PRIO0_IPV6_ADDRESS : HOST_PRIO0_IPV4_ADDRESS, results.get(2).getInetAddress());
        } finally {
            // Clean up test fixture.
            systemUnderTest.shutdownNow();
        }
    }
Unit tests for {@link org.jivesoftware.openfire.net.DNSUtil}.

@author Guus der Kinderen, guus.der.kinderen@gmail.com
xmppserver/src/test/java/org/jivesoftware/openfire/net/HappyEyeballsResolverTest.java