public static CLIServiceClientWrapper newRetryingCLIServiceClient(HiveConf conf) throws HiveSQLException {
    RetryingThriftCLIServiceClient retryClient = new RetryingThriftCLIServiceClient(conf);
    TTransport tTransport = retryClient
      .connectWithRetry(conf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_CLIENT_CONNECTION_RETRY_LIMIT));
    ICLIService cliService =
      (ICLIService) Proxy.newProxyInstance(RetryingThriftCLIServiceClient.class.getClassLoader(),
        CLIServiceClient.class.getInterfaces(), retryClient);
    return new CLIServiceClientWrapper(cliService, tTransport, conf);
  }
RetryingThriftCLIServiceClient. Creates a proxy for a CLIServiceClient
implementation and retries calls to it on failure.
service/src/java/org/apache/hive/service/cli/thrift/RetryingThriftCLIServiceClient.java