public void setAddress(String address) {
        if (GatewayType.LOCAL.equalsValue(type)
                && Asserts.isNotNull(configJson)
                && configJson.containsKey(RestOptions.PORT.key())) {
            int colonIndex = address.indexOf(':');
            if (colonIndex == -1) {
                this.address = address + NetConstant.COLON + configJson.get(RestOptions.PORT.key());
            } else {
                this.address = address.replaceAll("(?<=:)\\d{0,6}$", configJson.get(RestOptions.PORT.key()));
            }
        } else {
            this.address = address;
        }
    }
@Test
    void setAddress() {
        JobConfig jobConfig = new JobConfig();
        jobConfig.setAddress("127.0.0.1:8888");
        jobConfig.setType(GatewayType.LOCAL.getValue());
        Map<String, String> config = new HashMap<>();
        config.put(RestOptions.PORT.key(), "9999");

        jobConfig.setConfigJson(config);
        jobConfig.setAddress("127.0.0.1:7777");
        assertEquals("127.0.0.1:9999", jobConfig.getAddress());

        jobConfig.setAddress("127.0.0.2");
        assertEquals("127.0.0.2:9999", jobConfig.getAddress());

        config.remove(RestOptions.PORT.key());
        jobConfig.setAddress("127.0.0.2:6666");
        assertEquals("127.0.0.2:6666", jobConfig.getAddress());

        jobConfig.setType(GatewayType.STANDALONE.getLongValue());
        jobConfig.setAddress("127.0.0.3:6666");
        assertEquals("127.0.0.3:6666", jobConfig.getAddress());
    }