@Override
    public PulsarClient build() throws PulsarClientException {
        checkArgument(StringUtils.isNotBlank(conf.getServiceUrl()) || conf.getServiceUrlProvider() != null,
                "service URL or service URL provider needs to be specified on the ClientBuilder object.");
        checkArgument(StringUtils.isBlank(conf.getServiceUrl())  || conf.getServiceUrlProvider() == null,
                "Can only chose one way service URL or service URL provider.");

        if (conf.getServiceUrlProvider() != null) {
            checkArgument(StringUtils.isNotBlank(conf.getServiceUrlProvider().getServiceUrl()),
                    "Cannot get service url from service url provider.");
            conf.setServiceUrl(conf.getServiceUrlProvider().getServiceUrl());
        }
        PulsarClient client = new PulsarClientImpl(conf);
        if (conf.getServiceUrlProvider() != null) {
            conf.getServiceUrlProvider().initialize(client);
        }
        return client;
    }
@Test(expectedExceptions = IllegalArgumentException.class)
    public void testClientBuilderWithServiceUrlAndServiceUrlProviderNotSet() throws PulsarClientException {
        PulsarClient.builder().build();
    }