Example usage for com.squareup.okhttp Protocol get

List of usage examples for com.squareup.okhttp Protocol get

Introduction

In this page you can find the example usage for com.squareup.okhttp Protocol get.

Prototype

public static Protocol get(String protocol) throws IOException 

Source Link

Document

Returns the protocol identified by protocol .

Usage

From source file:com.magnet.max.android.rest.qos.internal.CachedResponse.java

License:Apache License

public Protocol getProtocolEnum() {
    if (null != protocol) {
        try {// w w w. j a  v a  2s.  co  m
            return Protocol.get(protocol);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    return Protocol.HTTP_1_1;
}

From source file:io.apiman.gateway.platforms.servlet.connectors.ok.HttpURLConnectionImpl.java

License:Apache License

private void setProtocols(String protocolsString, boolean append) {
    List<Protocol> protocolsList = new ArrayList<>();
    if (append) {
        protocolsList.addAll(client.getProtocols());
    }/*from   w  w w.  java  2s . c o m*/
    for (String protocol : protocolsString.split(",", -1)) {
        try {
            protocolsList.add(Protocol.get(protocol));
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
    }
    client.setProtocols(protocolsList);
}