Java Code Examples for cn.jiguang.common.ClientConfig#getMaxRetryTimes()

The following examples show how to use cn.jiguang.common.ClientConfig#getMaxRetryTimes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NettyHttpClient.java    From jiguang-java-client-common with MIT License 6 votes vote down vote up
public NettyHttpClient(String authCode, HttpProxy proxy, ClientConfig config) {
    _maxRetryTimes = config.getMaxRetryTimes();
    _readTimeout = config.getReadTimeout();
    String message = MessageFormat.format("Created instance with "
                    + "connectionTimeout {0}, readTimeout {1}, maxRetryTimes {2}, SSL Version {3}",
            config.getConnectionTimeout(), _readTimeout, _maxRetryTimes, config.getSSLVersion());
    LOG.debug(message);
    _authCode = authCode;
    _encryptType = config.getEncryptType();
    try {
        _sslCtx = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();
        _workerGroup = new NioEventLoopGroup();
        b = new Bootstrap(); // (1)
        b.group(_workerGroup); // (2)
        b.channel(NioSocketChannel.class); // (3)
        b.option(ChannelOption.SO_KEEPALIVE, true); // (4)
    } catch (SSLException e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: Http2Client.java    From jiguang-java-client-common with MIT License 6 votes vote down vote up
public Http2Client(String authCode, HttpProxy proxy, ClientConfig config) {
    _maxRetryTimes = config.getMaxRetryTimes();
    _connectionTimeout = config.getConnectionTimeout();
    _readTimeout = config.getReadTimeout();
    _sslVer = config.getSSLVersion();

    _authCode = authCode;
    _proxy = proxy;
    _encryptType = config.getEncryptType();
    String message = MessageFormat.format("Created instance with "
                    + "connectionTimeout {0}, readTimeout {1}, maxRetryTimes {2}, SSL Version {3}",
            _connectionTimeout, _readTimeout, _maxRetryTimes, _sslVer);
    LOG.info(message);

    if (null != _proxy && _proxy.isAuthenticationNeeded()) {
        Authenticator.setDefault(new NativeHttpClient.SimpleProxyAuthenticator(
                _proxy.getUsername(), _proxy.getPassword()));
    }
}
 
Example 3
Source File: NativeHttpClient.java    From jiguang-java-client-common with MIT License 6 votes vote down vote up
public NativeHttpClient(String authCode, HttpProxy proxy, ClientConfig config ) {
      _maxRetryTimes = config.getMaxRetryTimes();
_connectionTimeout = config.getConnectionTimeout();
_readTimeout = config.getReadTimeout();
_sslVer = config.getSSLVersion();
      _encryptType = config.getEncryptType();
_authCode = authCode;
_proxy = proxy;

String message = MessageFormat.format("Created instance with "
				+ "connectionTimeout {0}, readTimeout {1}, maxRetryTimes {2}, SSL Version {3}",
		_connectionTimeout, _readTimeout, _maxRetryTimes, _sslVer);
      LOG.debug(message);

      if ( null != _proxy && _proxy.isAuthenticationNeeded()) {
      	Authenticator.setDefault(new SimpleProxyAuthenticator(
              _proxy.getUsername(), _proxy.getPassword()));
      }
      initSSL(_sslVer);
  }
 
Example 4
Source File: ApacheHttpClient.java    From jiguang-java-client-common with MIT License 5 votes vote down vote up
public ApacheHttpClient(String authCode, HttpProxy proxy, ClientConfig config) {
    _maxRetryTimes = config.getMaxRetryTimes();
    _connectionTimeout = config.getConnectionTimeout();
    _connectionRequestTimeout = config.getConnectionRequestTimeout();
    _socketTimeout = config.getSocketTimeout();
    _authCode = authCode;
    _encryptType = config.getEncryptType();
    if (proxy != null) {
        _proxy = new HttpHost(proxy.getHost(), proxy.getPort());
    }
}