Huawei Api Client 连接回调
@param rst 结果码
@param client HuaweiApiClient 实例
167405
@Override
    public void onConnect(int rst, HuaweiApiClient client) {

        HMSAgentLog.d("onConnect:" + rst);

        if (client == null || !ApiClientMgr.INST.isConnect(client)) {
            HMSAgentLog.e("client not connted");
            onProductDetailResult(rst, null);
            return;
        }

        // 调用HMS-SDK getOrderDetail 接口
        PendingResult<ProductDetailResult> checkPayResult = HuaweiPay.HuaweiPayApi.getProductDetails(client, productDetailReq);
        checkPayResult.setResultCallback(new ResultCallback<ProductDetailResult>() {
            @Override
            public void onResult(ProductDetailResult result) {

                if (result == null) {
                    HMSAgentLog.e("result is null");
                    onProductDetailResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
                    return;
                }

                Status status = result.getStatus();
                if (status == null) {
                    HMSAgentLog.e("status is null");
                    onProductDetailResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
                    return;
                }

                int rstCode = status.getStatusCode();
                HMSAgentLog.d("status=" + status);
                // 需要重试的错误码，并且可以重试
                if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
                        || rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
                    retryTimes--;
                    connect();
                } else {
                    onProductDetailResult(rstCode, result);
                }
            }
        });
    }
1019588
@Override
	protected Rcli<HttpURLConnection> rclient(URI ignoredURI, SecuritySetter<HttpURLConnection> ss) throws CadiException {
		if(hman.loc==null) {
			throw new CadiException("No Locator set in AAFConHttp"); 
		}
		try {
			return new HRcli(hman, hman.loc.best() ,ss);
		} catch (Exception e) {
			throw new CadiException(e);
		}
	}
63437
public static void serverReceived(NettyHttpRequest request) {
        try {
            SofaRequest sofaRequest = new SofaRequest();

            HttpHeaders headers = request.getHttpHeaders();
            String rpcTraceContext = headers.getHeaderString(RemotingConstants.NEW_RPC_TRACE_NAME);
            if (StringUtils.isNotBlank(rpcTraceContext)) {
                // 新格式
                sofaRequest.addRequestProp(RemotingConstants.NEW_RPC_TRACE_NAME, rpcTraceContext);
            } else {
                String traceIdKey = headers.getHeaderString(RemotingConstants.HTTP_HEADER_TRACE_ID_KEY);
                String rpcIdKey = headers.getHeaderString(RemotingConstants.HTTP_HEADER_RPC_ID_KEY);
                if (StringUtils.isEmpty(rpcIdKey)) {
                    rpcIdKey = request.getUri().getQueryParameters().getFirst(RemotingConstants.RPC_ID_KEY);
                }
                if (StringUtils.isEmpty(traceIdKey)) {
                    traceIdKey = request.getUri().getQueryParameters().getFirst(RemotingConstants.TRACE_ID_KEY);
                }

                if (StringUtils.isNotEmpty(traceIdKey) && StringUtils.isNotEmpty(rpcIdKey)) {
                    Map<String, String> map = new HashMap<String, String>();
                    map.put(RemotingConstants.TRACE_ID_KEY, traceIdKey);
                    map.put(RemotingConstants.RPC_ID_KEY, rpcIdKey);
                    String penAttrs = headers.getHeaderString(RemotingConstants.PEN_ATTRS_KEY);
                    map.put(RemotingConstants.PEN_ATTRS_KEY, penAttrs);
                    sofaRequest.addRequestProp(RemotingConstants.RPC_TRACE_NAME, map);
                }
            }
            Tracers.serverReceived(sofaRequest);
        } catch (Throwable t) {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("the process of rest tracer server receive occur error ", t);
            }
        }
    }
444442
@Override
    public void onConnect(int rst, HuaweiApiClient client) {

        HMSAgentLog.d("onConnect:" + rst);

        if (client == null || !ApiClientMgr.INST.isConnect(client)) {
            HMSAgentLog.e("client not connted");
            onLoginResult(rst, null);
            return;
        }

        Activity curActivity = ActivityMgr.INST.getLastActivity();
        if (curActivity == null) {
            HMSAgentLog.e("activity is null");
            onLoginResult(HMSAgent.AgentResultCode.NO_ACTIVITY_FOR_USE, null);
            return;
        }

        /**
         * 调用login接口，传入成功回调。 此回调仅在成功时回调。
         */
        HMSAgentLog.d("begin login by HMS-SDK");
        PendingResult<GameLoginResult> loginPending = HuaweiGame.HuaweiGameApi.login(client, curActivity, forceLogin, new GameLoginHandler(){

            @Override
            public void onResult(int retCode, GameUserData userData) {
                HMSAgentLog.d("onResult:retCode=" + retCode + "  userData=" + StrUtils.objDesc(userData));
                onLoginResult(retCode, userData);
            }

            @Override
            public void onChange() {
                HMSAgentLog.d("onChange");

                new Handler(Looper.getMainLooper()).post(new Runnable() {
                    @Override
                    public void run() {
                        if (handler != null) {
                            handler.onChange();
                        }
                    }
                });
            }
        });

        loginPending.setResultCallback(new ResultCallback<GameLoginResult>() {
            @Override
            public void onResult(GameLoginResult result) {

                if (result == null) {
                    HMSAgentLog.e("result is null");
                    onLoginResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
                    return;
                }

                Status status = result.getStatus();
                if (status == null) {
                    HMSAgentLog.e("status is null");
                    onLoginResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
                    return;
                }

                int rstCode = status.getStatusCode();
                HMSAgentLog.d("status=" + status);

                if (!result.getStatus().isSuccess()) {
                    // 需要重试的错误码，并且可以重试
                    if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
                            || rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
                        retryTimes--;
                        connect();
                    } else {
                        onLoginResult(rstCode, null);
                    }
                } else {
                    // 经确认，成功的情况下会走上面handler里面的2个回调,
                    // 这边不需要任何处理
                }
            }
        });
    }
1210813
public void setHttpClient(HttpClient httpClient) {
		Assert.isInstanceOf(CloseableHttpClient.class, httpClient, "'httpClient' is not of type CloseableHttpClient");
		this.httpClient = (CloseableHttpClient) httpClient;
	}
153286
@Override
    public void onActivityPause(Activity activity) {
        // 通知hmssdk，activity onPause了
        HuaweiApiClient client = getApiClient();
        if (client != null) {
            client.onPause(activity);
        }
    }
718251
@Override
    public ResourceSet<TollFree> read(final TwilioRestClient client) {
        return new ResourceSet<>(this, client, firstPage(client));
    }
1254125
@Override
    public ResourceSet<National> read(final TwilioRestClient client) {
        return new ResourceSet<>(this, client, firstPage(client));
    }
24447
private Page<AvailablePhoneNumberCountry> pageForRequest(final TwilioRestClient client, final Request request) {
        Response response = client.request(request);

        if (response == null) {
            throw new ApiConnectionException("AvailablePhoneNumberCountry read failed: Unable to connect to server");
        } else if (!TwilioRestClient.SUCCESS.apply(response.getStatusCode())) {
            RestException restException = RestException.fromJson(response.getStream(), client.getObjectMapper());
            if (restException == null) {
                throw new ApiException("Server Error, no content");
            }

            throw new ApiException(
                restException.getMessage(),
                restException.getCode(),
                restException.getMoreInfo(),
                restException.getStatus(),
                null
            );
        }

        return Page.fromJson(
            "countries",
            response.getContent(),
            AvailablePhoneNumberCountry.class,
            client.getObjectMapper()
        );
    }
1209688
@Override
    public ResourceSet<Fleet> read(final TwilioRestClient client) {
        return new ResourceSet<>(this, client, firstPage(client));
    }
337247
public static void createAsync(final TemplateBasedViewBuilderClient client) {
        GWT.runAsync(new RunAsyncCallback() {
            public void onFailure(Throwable err) {
                client.onUnavailable();
                throw new IllegalStateException(err);
            }

            public void onSuccess() {
                GWTVizPlot.createAsync(new GWTVizPlot.GWTVizPlotClient() {
                    @Override
                    public void onSuccess(GWTVizPlot gwtVizPlot) {
                        if (instance == null) {
                            instance = new TemplateBasedViewBuilder(gwtVizPlot);
                        }
                        client.onSuccess(instance);
                    }

                    @Override
                    public void onUnavailable() {
                        throw new IllegalStateException("unable to load plotter");
                    }
                });


            }
        });
    }
258507
@Override
    public ResourceSet<SubscribedTrack> read(final TwilioRestClient client) {
        return new ResourceSet<>(this, client, firstPage(client));
    }
120392
private void setupClient(final AbstractHttpClient client) {
		this.client.addResponseInterceptor(new HttpResponseInterceptor() {
			@Override
			public void process(final HttpResponse response, final HttpContext context)
					throws HttpException, IOException {
				Header header = response.getFirstHeader("Location");
				if (header!=null)
					context.setAttribute("Location", header.getValue());
			}
		});
	}
1179694
@Override
    public ResourceSet<SyncStream> read(final TwilioRestClient client) {
        return new ResourceSet<>(this, client, firstPage(client));
    }
1043326
@Override
    public ResourceSet<Query> read(final TwilioRestClient client) {
        return new ResourceSet<>(this, client, firstPage(client));
    }
1342404
function rrRoute(client, serverType, msg, cb) {
    const servers = client._station.serversMap[serverType];
    if (!servers || !servers.length) {
        utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
        return;
    }
    let index;
    if (!client.rrParam) {
        client.rrParam = {};
    }
    if (client.rrParam[serverType]) {
        index = client.rrParam[serverType];
    } else {
        index = 0;
    }
    utils.invokeCallback(cb, null, servers[index % servers.length]);
    if (index++ === Number.MAX_VALUE) {
        index = 0;
    }
    client.rrParam[serverType] = index;
}
360217
@Override
    public ResourceSet<IncomingPhoneNumber> read(final TwilioRestClient client) {
        return new ResourceSet<>(this, client, firstPage(client));
    }