Example usage for com.squareup.okhttp ConnectionSpec COMPATIBLE_TLS

List of usage examples for com.squareup.okhttp ConnectionSpec COMPATIBLE_TLS

Introduction

In this page you can find the example usage for com.squareup.okhttp ConnectionSpec COMPATIBLE_TLS.

Prototype

ConnectionSpec COMPATIBLE_TLS

To view the source code for com.squareup.okhttp ConnectionSpec COMPATIBLE_TLS.

Click Source Link

Document

A backwards-compatible fallback connection for interop with obsolete servers.

Usage

From source file:co.paralleluniverse.fibers.okhttp.CallTest.java

License:Open Source License

@Test
public void cleartextCallsFailWhenCleartextIsDisabled() throws Exception {
    // Configure the client with only TLS configurations. No cleartext!
    client.setConnectionSpecs(Arrays.asList(ConnectionSpec.MODERN_TLS, ConnectionSpec.COMPATIBLE_TLS));

    server.enqueue(new MockResponse());

    Request request = new Request.Builder().url(server.getUrl("/")).build();
    try {/*from w  w  w  .  ja  v  a  2s . com*/
        FiberOkHttpUtil.executeInFiber(client, request);
        fail();
    } catch (UnknownServiceException expected) {
        assertTrue(expected.getMessage().contains("CLEARTEXT communication not supported"));
    }
}