@VisibleForTesting
    @Nullable
    static String getHostAddress(InetSocketAddress socketAddress) {
        InetAddress address = socketAddress.getAddress();
        if (address instanceof Inet6Address) {
            // Strip the scope from the address since some other classes choke on it.
            // TODO(carl-mastrangelo): Consider adding this back in once issues like
            // https://github.com/google/guava/issues/2587 are fixed.
            try {
                return InetAddress.getByAddress(address.getAddress()).getHostAddress();
            } catch (UnknownHostException e) {
                throw new RuntimeException(e);
            }
        } else if (address instanceof Inet4Address) {
            return address.getHostAddress();
        } else {
            assert address == null;
            return null;
        }
    }
@Test
    void ipv6AddressScopeNameRemoved() throws Exception {
        List<NetworkInterface> nics = Collections.list(NetworkInterface.getNetworkInterfaces());
        Assumptions.assumeTrue(!nics.isEmpty(), "No network interfaces");

        List<Throwable> failures = new ArrayList<>();
        for (NetworkInterface nic : nics) {
            Inet6Address address;
            try {
                address = Inet6Address.getByAddress(
                        "localhost", new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, nic);
            } catch (UnknownHostException e) {
                // skip, the nic doesn't match
                failures.add(e);
                continue;
            }

            assertTrue(address.toString().contains("%"), address.toString());

            String addressString = SourceAddressChannelHandler.getHostAddress(new InetSocketAddress(address, 8080));

            assertEquals("0:0:0:0:0:0:0:1", addressString);
            return;
        }

        AssumptionViolatedException failure = new AssumptionViolatedException("No Compatible Nics were found");
        failures.forEach(failure::addSuppressed);
        throw failure;
    }