com.squareup.okhttp.internal.Util.immutableList()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(200)

本文整理了Java中com.squareup.okhttp.internal.Util.immutableList()方法的一些代码示例,展示了Util.immutableList()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.immutableList()方法的具体详情如下:
包路径:com.squareup.okhttp.internal.Util
类名称:Util
方法名:immutableList

Util.immutableList介绍

暂无

代码示例

代码示例来源:origin: com.squareup.okhttp/mockwebserver

/**
 * Indicates the protocols supported by ALPN on incoming HTTPS
 * connections. This list is ignored when
 * {@link #setProtocolNegotiationEnabled negotiation is disabled}.
 *
 * @param protocols the protocols to use, in order of preference. The list
 *     must contain {@linkplain Protocol#HTTP_1_1}. It must not contain null.
 */
public void setProtocols(List<Protocol> protocols) {
 protocols = Util.immutableList(protocols);
 if (!protocols.contains(Protocol.HTTP_1_1)) {
  throw new IllegalArgumentException("protocols doesn't contain http/1.1: " + protocols);
 }
 if (protocols.contains(null)) {
  throw new IllegalArgumentException("protocols must not contain null");
 }
 this.protocols = protocols;
}

代码示例来源:origin: apiman/apiman

/**
 * 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);
}

代码示例来源:origin: io.apiman/apiman-common-net

/**
 * 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);
}

代码示例来源:origin: apiman/apiman

/**
 * @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;
}

代码示例来源:origin: io.apiman/apiman-gateway-platforms-servlet

/**
 * @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;
}

相关文章