Java Code Examples for com.squareup.okhttp.internal.Util#immutableList()

The following examples show how to use com.squareup.okhttp.internal.Util#immutableList() . 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: Address.java    From android-discourse with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 2
Source File: Address.java    From L.TileLayer.Cordova with MIT License 5 votes vote down vote up
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);
}
 
Example 3
Source File: Address.java    From wildfly-samples with MIT License 5 votes vote down vote up
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);
}
 
Example 4
Source File: Address.java    From CordovaYoutubeVideoPlayer with MIT License 5 votes vote down vote up
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);
}
 
Example 5
Source File: Address.java    From phonegapbootcampsite with MIT License 5 votes vote down vote up
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);
}
 
Example 6
Source File: Address.java    From cordova-amazon-fireos with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 7
Source File: Address.java    From reader with MIT License 5 votes vote down vote up
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);
}
 
Example 8
Source File: Address.java    From reader with MIT License 5 votes vote down vote up
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);
}
 
Example 9
Source File: Address.java    From crosswalk-cordova-android with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 10
Source File: Address.java    From IoTgo_Android_App with MIT License 5 votes vote down vote up
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);
}
 
Example 11
Source File: OkHttpClient.java    From reader with MIT License 3 votes vote down vote up
/**
 * 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;
}
 
Example 12
Source File: OkHttpClient.java    From reader with MIT License 3 votes vote down vote up
/**
 * 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;
}
 
Example 13
Source File: OkHttpClient.java    From bluemix-parking-meter with MIT License 3 votes vote down vote up
/**
 * 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;
}
 
Example 14
Source File: OkHttpClient.java    From cordova-amazon-fireos with Apache License 2.0 3 votes vote down vote up
/**
 * 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;
}
 
Example 15
Source File: OkHttpClient.java    From android-discourse with Apache License 2.0 3 votes vote down vote up
/**
 * 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/>
 * <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/>
 * <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/>
 * <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;
}
 
Example 16
Source File: OkHttpClient.java    From phonegapbootcampsite with MIT License 3 votes vote down vote up
/**
 * 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;
}
 
Example 17
Source File: OkHttpClient.java    From CordovaYoutubeVideoPlayer with MIT License 3 votes vote down vote up
/**
 * 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;
}
 
Example 18
Source File: OkHttpClient.java    From IoTgo_Android_App with MIT License 3 votes vote down vote up
/**
 * 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;
}
 
Example 19
Source File: OkHttpClient.java    From crosswalk-cordova-android with Apache License 2.0 3 votes vote down vote up
/**
 * 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;
}
 
Example 20
Source File: OkHttpClient.java    From L.TileLayer.Cordova with MIT License 3 votes vote down vote up
/**
 * 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;
}