public SocketAddress apply()

in zuul-core/src/main/java/com/netflix/zuul/netty/server/SocketAddressProperty.java [111:158]


        public SocketAddress apply(String input) {
            if (input == null || input.isEmpty()) {
                throw new IllegalArgumentException("Invalid address");
            }

            int equalsPosition = input.indexOf('=');
            if (equalsPosition == -1) {
                throw new IllegalArgumentException("Invalid address " + input);
            }
            String rawBindType = equalsPosition != 0 ? input.substring(0, equalsPosition) : BindType.ANY.name();
            BindType bindType = BindType.valueOf(rawBindType.toUpperCase(Locale.ROOT));
            String rawAddress = input.substring(equalsPosition + 1);
            int port;

            switch (bindType) {
                case ANY: // fallthrough
                case IPV4_ANY: // fallthrough
                case IPV6_ANY: // fallthrough
                case ANY_LOCAL: // fallthrough
                case IPV4_LOCAL: // fallthrough
                case IPV6_LOCAL: // fallthrough
                    try {
                        port = Integer.parseInt(rawAddress);
                    } catch (NumberFormatException e) {
                        throw new IllegalArgumentException("Invalid Port " + input, e);
                    }
                    break;
                case UDS:
                    port = -1;
                    break;
                default:
                    throw new AssertionError("Missed cased: " + bindType);
            }

            switch (bindType) {
                case ANY:
                    return new InetSocketAddress(port);
                case IPV4_ANY: // fallthrough
                case IPV6_ANY: // fallthrough
                case ANY_LOCAL: // fallthrough
                case IPV4_LOCAL: // fallthrough
                case IPV6_LOCAL: // fallthrough
                    return new InetSocketAddress(bindType.addressSupplier.get(), port);
                case UDS:
                    return new DomainSocketAddress(rawAddress);
            }
            throw new AssertionError("Missed cased: " + bindType);
        }