@ParameterizedTest
    @ValueSource(booleans = {true, false})
    public void testFirstResultWhenPreferredHostProvidedFirst(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, 0);
            systemUnderTest.solve(SOLVER_PRIO1_BOTHFAMS_DELAYED_SHORT, 1);
            final ResolvedServiceAddress result = systemUnderTest.getNext();

            // Verify results.
            assertNotNull(result);
            final InetAddress expected = preferIpv4 ? HOST_PRIO0_IPV4_ADDRESS : HOST_PRIO0_IPV6_ADDRESS;
            assertEquals(expected, result.generateSocketAddress().getAddress());
        } 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