Example usage for com.squareup.okhttp OkHttpClient getConnectionSpecs

List of usage examples for com.squareup.okhttp OkHttpClient getConnectionSpecs

Introduction

In this page you can find the example usage for com.squareup.okhttp OkHttpClient getConnectionSpecs.

Prototype

public List<ConnectionSpec> getConnectionSpecs() 

Source Link

Usage

From source file:com.raskasa.metrics.okhttp.InstrumentedOkHttpClientsTest.java

License:Apache License

private void assertThatClientsAreEqual(OkHttpClient clientA, OkHttpClient clientB) {
    assertThat(clientA.getDispatcher()).isEqualTo(clientB.getDispatcher());
    assertThat(clientA.getProxy()).isEqualTo(clientB.getProxy());
    assertThat(clientA.getProtocols()).isEqualTo(clientB.getProtocols());
    assertThat(clientA.getConnectionSpecs()).isEqualTo(clientB.getConnectionSpecs());
    assertThat(clientA.getProxySelector()).isEqualTo(clientB.getProxySelector());
    assertThat(clientA.getCookieHandler()).isEqualTo(clientB.getCookieHandler());
    assertThat(clientA.getCache()).isEqualTo(clientB.getCache());
    assertThat(clientA.getSocketFactory()).isEqualTo(clientB.getSocketFactory());
    assertThat(clientA.getSslSocketFactory()).isEqualTo(clientB.getSslSocketFactory());
    assertThat(clientA.getHostnameVerifier()).isEqualTo(clientB.getHostnameVerifier());
    assertThat(clientA.getCertificatePinner()).isEqualTo(clientB.getCertificatePinner());
    assertThat(clientA.getAuthenticator()).isEqualTo(clientB.getAuthenticator());
    assertThat(clientA.getConnectionPool()).isEqualTo(clientB.getConnectionPool());
    assertThat(clientA.getFollowSslRedirects()).isEqualTo(clientB.getFollowSslRedirects());
    assertThat(clientA.getFollowRedirects()).isEqualTo(clientB.getFollowRedirects());
    assertThat(clientA.getRetryOnConnectionFailure()).isEqualTo(clientB.getRetryOnConnectionFailure());
    assertThat(clientA.getConnectTimeout()).isEqualTo(clientB.getConnectTimeout());
    assertThat(clientA.getReadTimeout()).isEqualTo(clientB.getReadTimeout());
    assertThat(clientA.getWriteTimeout()).isEqualTo(clientB.getWriteTimeout());
}

From source file:org.sonar.runner.impl.OkHttpClientFactoryTest.java

License:Open Source License

private void assertTlsAndClearTextSpecifications(OkHttpClient client) {
    List<ConnectionSpec> connectionSpecs = client.getConnectionSpecs();
    assertThat(connectionSpecs).hasSize(2);

    // TLS. tlsVersions()==null means all TLS versions
    assertThat(connectionSpecs.get(0).tlsVersions()).isNull();
    assertThat(connectionSpecs.get(0).isTls()).isTrue();

    // HTTP//from w  w  w.j  a va2  s .c o  m
    assertThat(connectionSpecs.get(1).tlsVersions()).isNull();
    assertThat(connectionSpecs.get(1).isTls()).isFalse();
}