public static String localHostIP() {
        if (PREFER_IPV6_ADDRESSES) {
            return LOCAL_HOST_IP_V6;
        }
        return LOCAL_HOST_IP_V4;
    }
@Test
    void testLocalHostIP() throws NoSuchFieldException, IllegalAccessException {
        Field field = InternetAddressUtil.class.getField("PREFER_IPV6_ADDRESSES");
        field.setAccessible(true);
        Field modifiersField = Field.class.getDeclaredField("modifiers");
        modifiersField.setAccessible(true);
        modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
        
        field.set(null, false);
        assertEquals("127.0.0.1", InternetAddressUtil.localHostIP());
        
        field.set(null, true);
        assertEquals("[::1]", InternetAddressUtil.localHostIP());
    }