Java 类com.squareup.okhttp.ConnectionPool 实例源码

项目:platform_external_okhttp    文件:Main.java   
private OkHttpClient createClient() {
  OkHttpClient client = new OkHttpClient();
  client.setFollowProtocolRedirects(followRedirects);
  if (connectTimeout != DEFAULT_TIMEOUT) {
    client.setConnectTimeout(connectTimeout, SECONDS);
  }
  if (readTimeout != DEFAULT_TIMEOUT) {
    client.setReadTimeout(readTimeout, SECONDS);
  }
  if (allowInsecure) {
    client.setSslSocketFactory(createInsecureSslSocketFactory());
  }
  // If we don't set this reference, there's no way to clean shutdown persistent connections.
  client.setConnectionPool(ConnectionPool.getDefault());
  return client;
}
项目:apiman    文件:HttpConnectorFactory.java   
/**
 * @return a new http client
 */
private OkHttpClient createHttpClient() {
    OkHttpClient client = new OkHttpClient();
    client.setReadTimeout(connectorOptions.getReadTimeout(), TimeUnit.SECONDS);
    client.setWriteTimeout(connectorOptions.getWriteTimeout(), TimeUnit.SECONDS);
    client.setConnectTimeout(connectorOptions.getConnectTimeout(), TimeUnit.SECONDS);
    client.setFollowRedirects(connectorOptions.isFollowRedirects());
    client.setFollowSslRedirects(connectorOptions.isFollowRedirects());
    client.setProxySelector(ProxySelector.getDefault());
    client.setCookieHandler(CookieHandler.getDefault());
    client.setCertificatePinner(CertificatePinner.DEFAULT);
    client.setAuthenticator(AuthenticatorAdapter.INSTANCE);
    client.setConnectionPool(ConnectionPool.getDefault());
    client.setProtocols(Util.immutableList(Protocol.HTTP_1_1));
    client.setConnectionSpecs(DEFAULT_CONNECTION_SPECS);
    client.setSocketFactory(SocketFactory.getDefault());
    Internal.instance.setNetwork(client, Network.DEFAULT);

    return client;
}
项目:apiman    文件:HawkularMetricsClient.java   
/**
 * Constructor.
 * @param metricsServer
 */
public HawkularMetricsClient(URL metricsServer) {
    this.serverUrl = metricsServer;
    httpClient = new OkHttpClient();
    httpClient.setReadTimeout(DEFAULT_READ_TIMEOUT, TimeUnit.SECONDS);
    httpClient.setWriteTimeout(DEFAULT_WRITE_TIMEOUT, TimeUnit.SECONDS);
    httpClient.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT, TimeUnit.SECONDS);
    httpClient.setFollowRedirects(true);
    httpClient.setFollowSslRedirects(true);
    httpClient.setProxySelector(ProxySelector.getDefault());
    httpClient.setCookieHandler(CookieHandler.getDefault());
    httpClient.setCertificatePinner(CertificatePinner.DEFAULT);
    httpClient.setAuthenticator(AuthenticatorAdapter.INSTANCE);
    httpClient.setConnectionPool(ConnectionPool.getDefault());
    httpClient.setProtocols(Util.immutableList(Protocol.HTTP_1_1));
    httpClient.setConnectionSpecs(DEFAULT_CONNECTION_SPECS);
    httpClient.setSocketFactory(SocketFactory.getDefault());
    Internal.instance.setNetwork(httpClient, Network.DEFAULT);
}
项目:add_to_evernote_note    文件:EvernoteClientFactory.java   
private OkHttpClient createDefaultHttpClient() {
    OkHttpClient httpClient = new OkHttpClient();
    httpClient.setConnectTimeout(10, TimeUnit.SECONDS);
    httpClient.setReadTimeout(10, TimeUnit.SECONDS);
    httpClient.setWriteTimeout(20, TimeUnit.SECONDS);
    httpClient.setConnectionPool(new ConnectionPool(20, 2 * 60 * 1000));
    return httpClient;
}
项目:LoRaWAN-Smart-Parking    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:LoRaWAN-Smart-Parking    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:ReactNativeSignatureExample    文件:DevServerHelper.java   
public void startPollingOnChangeEndpoint(
    OnServerContentChangeListener onServerContentChangeListener) {
  if (mOnChangePollingEnabled) {
    // polling already enabled
    return;
  }
  mOnChangePollingEnabled = true;
  mOnServerContentChangeListener = onServerContentChangeListener;
  mOnChangePollingClient = new OkHttpClient();
  mOnChangePollingClient
      .setConnectionPool(new ConnectionPool(1, LONG_POLL_KEEP_ALIVE_DURATION_MS))
      .setConnectTimeout(HTTP_CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
  enqueueOnChangeEndpointLongPolling();
}
项目:react-native-ibeacon-android    文件:DevServerHelper.java   
public void startPollingOnChangeEndpoint(
    OnServerContentChangeListener onServerContentChangeListener) {
  if (mOnChangePollingEnabled) {
    // polling already enabled
    return;
  }
  mOnChangePollingEnabled = true;
  mOnServerContentChangeListener = onServerContentChangeListener;
  mOnChangePollingClient = new OkHttpClient();
  mOnChangePollingClient
      .setConnectionPool(new ConnectionPool(1, LONG_POLL_KEEP_ALIVE_DURATION_MS))
      .setConnectTimeout(HTTP_CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
  enqueueOnChangeEndpointLongPolling();
}
项目:react-native-box-loaders    文件:DevServerHelper.java   
public void startPollingOnChangeEndpoint(
    OnServerContentChangeListener onServerContentChangeListener) {
  if (mOnChangePollingEnabled) {
    // polling already enabled
    return;
  }
  mOnChangePollingEnabled = true;
  mOnServerContentChangeListener = onServerContentChangeListener;
  mOnChangePollingClient = new OkHttpClient();
  mOnChangePollingClient
      .setConnectionPool(new ConnectionPool(1, LONG_POLL_KEEP_ALIVE_DURATION_MS))
      .setConnectTimeout(HTTP_CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
  enqueueOnChangeEndpointLongPolling();
}
项目:fiat    文件:RetrofitConfig.java   
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
OkClient okClient() {
  val client = okHttpClientConfig.create();
  client.setConnectionPool(new ConnectionPool(maxIdleConnections, keepAliveDurationMs));
  client.setRetryOnConnectionFailure(retryOnConnectionFailure);
  client.interceptors().add(new RetryingInterceptor(maxElapsedBackoffMs));
  return new OkClient(client);
}
项目:smart-mirror-app    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:cordova-plugin-background-mode    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:halyard    文件:RetrofitConfig.java   
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
OkClient okClient() {
  OkHttpClient client = okHttpClientConfig.create();
  client.setConnectionPool(new ConnectionPool(maxIdleConnections, keepAliveDurationMs));
  client.setRetryOnConnectionFailure(retryOnConnectionFailure);
  return new OkClient(client);
}
项目:multirotorstuff-vtx-calc    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:FMTech    文件:HttpConnection.java   
public HttpConnection(ConnectionPool paramConnectionPool, Connection paramConnection, Socket paramSocket)
  throws IOException
{
  this.pool = paramConnectionPool;
  this.connection = paramConnection;
  this.socket = paramSocket;
  this.source = Okio.buffer(Okio.source(paramSocket));
  this.sink = Okio.buffer(Okio.sink(paramSocket));
}
项目:L.TileLayer.Cordova    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:cordova-android-tv    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:Cordova-Locale-Plugin    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:pubnub-rpi-smart-parking    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:IoTgo_Android_App    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:CanDoVS2015    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:krakn    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:krakn    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:krakn    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:krakn    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:krakn    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:posjs2    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:hustElectricity    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:Wetube    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:DemoArduinoAndroidCordovaBT    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:cordova-muse    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:android-discourse    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool, Dns dns, RouteDatabase routeDatabase) {
    this.address = address;
    this.uri = uri;
    this.proxySelector = proxySelector;
    this.pool = pool;
    this.dns = dns;
    this.routeDatabase = routeDatabase;
    this.postponedRoutes = new LinkedList<Route>();

    resetNextProxy(uri, address.getProxy());
}
项目:MinWageCalc    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:hackmxdf-2015    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:bluemix-parking-meter    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:NgFileExplorer    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:CrossWalkAndroidStudio    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:CrossWalkAndroidStudio    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:gwt-material-phonegap    文件:RouteSelector.java   
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool,
    Dns dns, RouteDatabase routeDatabase) {
  this.address = address;
  this.uri = uri;
  this.proxySelector = proxySelector;
  this.pool = pool;
  this.dns = dns;
  this.routeDatabase = routeDatabase;
  this.postponedRoutes = new LinkedList<Route>();

  resetNextProxy(uri, address.getProxy());
}
项目:BitcoinBlue    文件:ApiModule.java   
@Provides
@Singleton
Client provideClient(OkHttpClient client) {
    client = new OkHttpClient();
    client.setConnectTimeout(30, TimeUnit.SECONDS); // connect timeout
    client.setReadTimeout(30, TimeUnit.SECONDS);    // socket timeout
    client.setConnectionPool(new ConnectionPool(0, 5 * 60 * 1000));
    return new OkClient(client);
}