public static InetAddress fixScopeIdAndGetInetAddress(final InetAddress inetAddress) throws SocketException {

        if (!(inetAddress instanceof Inet6Address inet6Address)) {
            return inetAddress;
        }
        if (!inetAddress.isLinkLocalAddress() && !inetAddress.isSiteLocalAddress()) {
            return inetAddress;
        }

        if (inet6Address.getScopeId() > 0 || inet6Address.getScopedInterface() != null) {
            return inetAddress;

        }
        final Inet6Address resultInetAddress = findRealInet6Address(inet6Address);
        return resultInetAddress == null ? inetAddress : resultInetAddress;
    }
@Test
    public void testFixScopeIdAndGetInetAddress_whenLinkLocalAddress_withNoInterfaceBind() throws SocketException, UnknownHostException {
        Inet6Address inet6Address = createInet6AddressWithScope(SOME_LINK_LOCAL_ADDRESS, 0);
        assertThat(inet6Address.isLinkLocalAddress()).isTrue();

        InetAddress actual = AddressUtil.fixScopeIdAndGetInetAddress(inet6Address);

        assertEquals(inet6Address, actual);
    }