Updated on 2022-02-24 GMT+08:00

Methods of the NorthApiClient Class

The methods of the NorthApiClient class are used to create an application instance. They are the prerequisites for calling other SDK APIs. The following describes the main methods:

Method

Description

public void setClientInfo(ClientInfo clientInfo)

Initializes the parameters of NorthApiClient. For details on the definition of ClientInfo, see Methods of the Clientinfo Class.

public void setHttpConnection(int httpSocketTimeout, int httpConnectionTimeout, int maxConnectionAmount, int maxConnectionAmountPerRoute)

You can set the socket timeout interval (in milliseconds), connection timeout interval (in milliseconds), maximum number of connections, and maximum number of connections for each route in the HTTP connection pool. The default values of the four parameters are 30000, 30000, 200, and 200 respectively.

This method must be called before the initSSLConfig() or initSSLConfig(SSLConfig sslConfig) method is called.

public void initSSLConfig()

Initializes the two-way authentication configuration. Other methods can only be used after this method is called.

NOTICE:

This method uses a test certificate, which is an informal certificate, and does not verify the host name. Therefore, this method is used only in the integration interconnection commissioning phase.

public void initSSLConfig(SSLConfig sslConfig)

Initializes the two-way authentication configuration. Other methods can only be used after this method is called. For details on the definition of SSLConfig, see SSLConfig Class Method Description.

NOTICE:

This method is used to import certificates and can be used in commercial use. Before calling this method, you can call the setHostnameVerifier(HostnameVerifier hostnameVerifier) method to verify the host name. Otherwise, the strict host name verification is used by default.

public void setHostnameVerifier(HostnameVerifier hostnameVerifier)

Customizes the host name verification method. This method needs to be called before the initSSLConfig(SSLConfig sslConfig) method is called. Otherwise, the strict host name verification is used by default.

NOTICE:
  • If the host name in the commercial certificate is the same as that in the platform environment, you do not need to call this method. By default, the strict host name verification is used.
  • The host name verification method should be based on the security principle. The value true should not be returned directly.

public String getVersion()

Queries the SDK version.