本文整理匯總了Java中com.squareup.okhttp.internal.Util.immutableList方法的典型用法代碼示例。如果您正苦於以下問題:Java Util.immutableList方法的具體用法?Java Util.immutableList怎麽用?Java Util.immutableList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.squareup.okhttp.internal.Util
的用法示例。
在下文中一共展示了Util.immutableList方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: get
import com.squareup.okhttp.internal.Util; //導入方法依賴的package包/類
public static Handshake get(SSLSession session) {
String cipherSuite = session.getCipherSuite();
if (cipherSuite == null) {
throw new IllegalStateException("cipherSuite == null");
}
Certificate[] peerCertificates;
List<Certificate> peerCertificatesList;
List<Certificate> localCertificatesList;
try {
peerCertificates = session.getPeerCertificates();
} catch (SSLPeerUnverifiedException e) {
peerCertificates = null;
}
if (peerCertificates != null) {
peerCertificatesList = Util.immutableList(peerCertificates);
} else {
peerCertificatesList = Collections.emptyList();
}
Certificate[] localCertificates = session.getLocalCertificates();
if (localCertificates != null) {
localCertificatesList = Util.immutableList(localCertificates);
} else {
localCertificatesList = Collections.emptyList();
}
return new Handshake(cipherSuite, peerCertificatesList, localCertificatesList);
}
示例2: setProtocols
import com.squareup.okhttp.internal.Util; //導入方法依賴的package包/類
public OkHttpClient setProtocols(List<Protocol> protocols) {
List protocols2 = Util.immutableList((List) protocols);
if (!protocols2.contains(Protocol.HTTP_1_1)) {
throw new IllegalArgumentException("protocols doesn't contain http/1.1: " + protocols2);
} else if (protocols2.contains(Protocol.HTTP_1_0)) {
throw new IllegalArgumentException("protocols must not contain http/1.0: " +
protocols2);
} else if (protocols2.contains(null)) {
throw new IllegalArgumentException("protocols must not contain null");
} else {
this.protocols = Util.immutableList(protocols2);
return this;
}
}
示例3: if
import com.squareup.okhttp.internal.Util; //導入方法依賴的package包/類
public MultipartBuilder$MultipartRequestBody(MediaType type, ByteString boundary,
List<Headers> partHeaders, List<RequestBody>
partBodies) {
if (type == null) {
throw new NullPointerException("type == null");
}
this.boundary = boundary;
this.contentType = MediaType.parse(type + "; boundary=" + boundary.utf8());
this.partHeaders = Util.immutableList(partHeaders);
this.partBodies = Util.immutableList(partBodies);
}
示例4: Address
import com.squareup.okhttp.internal.Util; //導入方法依賴的package包/類
public Address(String uriHost, int uriPort, Dns dns, SocketFactory socketFactory,
SSLSocketFactory sslSocketFactory, HostnameVerifier hostnameVerifier,
CertificatePinner certificatePinner, Authenticator authenticator, Proxy proxy,
List<Protocol> protocols, List<ConnectionSpec> connectionSpecs, ProxySelector
proxySelector) {
this.url = new Builder().scheme(sslSocketFactory != null ? b.a : "http").host(uriHost)
.port(uriPort).build();
if (dns == null) {
throw new IllegalArgumentException("dns == null");
}
this.dns = dns;
if (socketFactory == null) {
throw new IllegalArgumentException("socketFactory == null");
}
this.socketFactory = socketFactory;
if (authenticator == null) {
throw new IllegalArgumentException("authenticator == null");
}
this.authenticator = authenticator;
if (protocols == null) {
throw new IllegalArgumentException("protocols == null");
}
this.protocols = Util.immutableList((List) protocols);
if (connectionSpecs == null) {
throw new IllegalArgumentException("connectionSpecs == null");
}
this.connectionSpecs = Util.immutableList((List) connectionSpecs);
if (proxySelector == null) {
throw new IllegalArgumentException("proxySelector == null");
}
this.proxySelector = proxySelector;
this.proxy = proxy;
this.sslSocketFactory = sslSocketFactory;
this.hostnameVerifier = hostnameVerifier;
this.certificatePinner = certificatePinner;
}
示例5: cipherSuites
import com.squareup.okhttp.internal.Util; //導入方法依賴的package包/類
public List<CipherSuite> cipherSuites() {
if (this.cipherSuites == null) {
return null;
}
Object[] result = new CipherSuite[this.cipherSuites.length];
for (int i = 0; i < this.cipherSuites.length; i++) {
result[i] = CipherSuite.forJavaName(this.cipherSuites[i]);
}
return Util.immutableList(result);
}
示例6: tlsVersions
import com.squareup.okhttp.internal.Util; //導入方法依賴的package包/類
public List<TlsVersion> tlsVersions() {
if (this.tlsVersions == null) {
return null;
}
Object[] result = new TlsVersion[this.tlsVersions.length];
for (int i = 0; i < this.tlsVersions.length; i++) {
result[i] = TlsVersion.forJavaName(this.tlsVersions[i]);
}
return Util.immutableList(result);
}
示例7: Address
import com.squareup.okhttp.internal.Util; //導入方法依賴的package包/類
public Address(String uriHost, int uriPort, SSLSocketFactory sslSocketFactory,
HostnameVerifier hostnameVerifier, OkAuthenticator authenticator, Proxy proxy,
List<String> transports) throws UnknownHostException {
if (uriHost == null) throw new NullPointerException("uriHost == null");
if (uriPort <= 0) throw new IllegalArgumentException("uriPort <= 0: " + uriPort);
if (authenticator == null) throw new IllegalArgumentException("authenticator == null");
if (transports == null) throw new IllegalArgumentException("transports == null");
this.proxy = proxy;
this.uriHost = uriHost;
this.uriPort = uriPort;
this.sslSocketFactory = sslSocketFactory;
this.hostnameVerifier = hostnameVerifier;
this.authenticator = authenticator;
this.transports = Util.immutableList(transports);
}
示例8: setConnectionSpecs
import com.squareup.okhttp.internal.Util; //導入方法依賴的package包/類
public OkHttpClient setConnectionSpecs(List<ConnectionSpec> connectionSpecs) {
this.connectionSpecs = Util.immutableList((List) connectionSpecs);
return this;
}
示例9: setTransports
import com.squareup.okhttp.internal.Util; //導入方法依賴的package包/類
/**
* Configure the transports used by this client to communicate with remote
* servers. By default this client will prefer the most efficient transport
* available, falling back to more ubiquitous transports. Applications should
* only call this method to avoid specific compatibility problems, such as web
* servers that behave incorrectly when SPDY is enabled.
*
* <p>The following transports are currently supported:
* <ul>
* <li><a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">http/1.1</a>
* <li><a href="http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3">spdy/3</a>
* </ul>
*
* <p><strong>This is an evolving set.</strong> Future releases may drop
* support for transitional transports (like spdy/3), in favor of their
* successors (spdy/4 or http/2.0). The http/1.1 transport will never be
* dropped.
*
* <p>If multiple protocols are specified, <a
* href="https://technotes.googlecode.com/git/nextprotoneg.html">NPN</a> will
* be used to negotiate a transport. Future releases may use another mechanism
* (such as <a href="http://tools.ietf.org/html/draft-friedl-tls-applayerprotoneg-02">ALPN</a>)
* to negotiate a transport.
*
* @param transports the transports to use, in order of preference. The list
* must contain "http/1.1". It must not contain null.
*/
public OkHttpClient setTransports(List<String> transports) {
transports = Util.immutableList(transports);
if (!transports.contains("http/1.1")) {
throw new IllegalArgumentException("transports doesn't contain http/1.1: " + transports);
}
if (transports.contains(null)) {
throw new IllegalArgumentException("transports must not contain null");
}
if (transports.contains("")) {
throw new IllegalArgumentException("transports contains an empty string");
}
this.transports = transports;
return this;
}