public T build() {
    Preconditions.checkArgument(null != serviceType, "ServiceType cannot be null.");
    Preconditions.checkArgument(null != clazz, "Service interface cannot be null.");
    Preconditions.checkArgument(clazz.isInterface(), "Service interface must be an interface.");
    if (null == factory) {
      if (null == strategy) {
        strategy = Strategy.RANDOM;
      }
      factory = LoadBalancerSupport.newFactory(strategy);
    }
    ServiceProxyFactory proxyFactory;
    switch (serviceType) {
      case THRIFT:
        proxyFactory = ThriftServiceProxyFactory.getInstance();
        break;
      default:
        throw new IllegalArgumentException("Not supported ServiceType: " + serviceType);
    }
    if (StringUtils.isEmpty(serviceName)) {
      serviceName = ServiceConfigHelper.buildDefaultServiceName(serviceType, clazz);
    }
    if (Strings.isNullOrEmpty(serviceGroup)) {
      serviceGroup = ZookeeperConfig.getServiceGroup(serviceName);
    }
    if (!Strings.isNullOrEmpty(user)) {}

    return proxyFactory.getService(serviceGroup, serviceName, factory, clazz);
  }
 public ThriftClientFactory(ServiceNode serviceNode, TProtocolFactory factory) {
   this.serviceNode = serviceNode;
   this.factory = factory;
   this.header =
       new TMessageHeader()
           .add(THeaderName.USER, ZookeeperConfig.getAclUserString())
           .add(THeaderName.SERVICE, serviceNode.getName())
           .encode();
 }