class ManagementClient implements Closeable {

    static String formatIP(String ip) {
        //it appears some system can return a binding with the zone specifier on the end
        if (ip.contains(":") && ip.contains("%")) {
            ip = ip.split("%")[0];
        }
        if (ip.equals("0.0.0.0")) {
            logger.debug("WildFly is bound to 0.0.0.0 which is correct, setting client to 127.0.0.1");
            ip = "127.0.0.1";
        }
        return ip;
    }

}

class ManagementClientTest {

    @Test
    public void shouldParseLocalIPAsNormalIP() {

        String sourceIp = "10.1.2.3";
        String formattedIp = ManagementClient.formatIP(sourceIp);
        Assert.assertEquals(sourceIp, formattedIp);
    }

}