public static void checkBrokerConfig(final Properties brokerConfig) throws MQClientException {
        // TODO: use MixAll.isPropertyValid() when jdk upgrade to 1.8
        if (brokerConfig.containsKey("brokerPermission")
            && !PermName.isValid(brokerConfig.getProperty("brokerPermission"))) {
            throw new MQClientException(ResponseCode.NO_PERMISSION,
                String.format("brokerPermission value: %s is invalid.", brokerConfig.getProperty("brokerPermission")));
        }
    }
@Test
    public void testBrokerConfigValid() throws MQClientException {
        Properties brokerConfig = new Properties();
        brokerConfig.setProperty("brokerPermission",
            String.valueOf(PermName.PERM_INHERIT | PermName.PERM_WRITE | PermName.PERM_READ));
        Validators.checkBrokerConfig(brokerConfig);

        brokerConfig.setProperty("brokerPermission", String.valueOf(PermName.PERM_WRITE | PermName.PERM_READ));
        Validators.checkBrokerConfig(brokerConfig);

        brokerConfig.setProperty("brokerPermission", String.valueOf(PermName.PERM_READ));
        Validators.checkBrokerConfig(brokerConfig);

        try {
            brokerConfig.setProperty("brokerPermission", String.valueOf(PermName.PERM_PRIORITY));
            Validators.checkBrokerConfig(brokerConfig);
        } catch (MQClientException e) {
            assertThat(e.getResponseCode()).isEqualTo(ResponseCode.NO_PERMISSION);
            assertThat(e.getErrorMessage()).isEqualTo(String.format("brokerPermission value: %s is invalid.", brokerConfig.getProperty("brokerPermission")));
        }

        try {
            brokerConfig.setProperty("brokerPermission", String.valueOf(PermName.PERM_PRIORITY | PermName.PERM_INHERIT));
            Validators.checkBrokerConfig(brokerConfig);
        } catch (MQClientException e) {
            assertThat(e.getResponseCode()).isEqualTo(ResponseCode.NO_PERMISSION);
            assertThat(e.getErrorMessage()).isEqualTo(String.format("brokerPermission value: %s is invalid.", brokerConfig.getProperty("brokerPermission")));
        }
    }