class IpUtils {

    public static InetSocketAddress parseAddress(String address) {
        if(StringUtils.isBlank(address)) {
            return null;
        }
        
        Matcher matcher = ipv6Pattern.matcher(address);
        if(matcher.matches()) {
            return parseMatch(matcher);
        }

        matcher = ipv4Pattern.matcher(address);
        if(StringUtils.countMatches(address, ":") == 1 && matcher.matches()) {
            return parseMatch(matcher);
        }

        logger.debug("Invalid address: {}. For ipv6 use de convention [address]:port. For ipv4 address:port", address);
        return null;
    }

}