public static String toString(InetAddress inetAddress) {
        if (inetAddress instanceof Inet6Address) {
            String address = InetAddresses.toAddrString(inetAddress);
            // toAddrString() returns any interface/scope as a %-suffix,
            // see https://github.com/google/guava/commit/3f61870ac6e5b18dbb74ce6f6cb2930ad8750a43
            int percentIndex = address.indexOf('%');
            return percentIndex < 0 ? address : address.substring(0, percentIndex);
        } else {
            return inetAddress.getHostAddress();
        }
    }
@Test
    void testToStringWithInterface() throws SocketException {
        NetworkInterface.networkInterfaces()
                .flatMap(NetworkInterface::inetAddresses)
                .forEach(inetAddress -> {
                    String address = InetAddressUtil.toString(inetAddress);
                    assertEquals(-1, address.indexOf('%'), "No interface in " + address);
                });
    }