当前位置: 首页>>代码示例>>Java>>正文


Java CertificatePinner类代码示例

本文整理汇总了Java中com.squareup.okhttp.CertificatePinner的典型用法代码示例。如果您正苦于以下问题:Java CertificatePinner类的具体用法?Java CertificatePinner怎么用?Java CertificatePinner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CertificatePinner类属于com.squareup.okhttp包,在下文中一共展示了CertificatePinner类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bindOkHttpClient

import com.squareup.okhttp.CertificatePinner; //导入依赖的package包/类
private void bindOkHttpClient() {
    mOkHttpClient.setSslSocketFactory(mSSLSocketFactory);
    mOkHttpClient.setHostnameVerifier(mHostnameVerifier);
    mOkHttpClient.setProxy(mProxy);
    mOkHttpClient.setConnectTimeout(mConnectTimeout, TimeUnit.MILLISECONDS);
    mOkHttpClient.setReadTimeout(mReadTimeout, TimeUnit.MILLISECONDS);
    mOkHttpClient.setWriteTimeout(mWriteTimeout, TimeUnit.MILLISECONDS);

    if (!mPinners.isEmpty()) {
        Set<Map.Entry<String, String>> sets = mPinners.entrySet();
        CertificatePinner.Builder cBuilder = new CertificatePinner.Builder();
        for (Map.Entry<String, String> entry : sets) {
            cBuilder.add(entry.getKey(), entry.getValue());
        }

        mOkHttpClient.setCertificatePinner(cBuilder.build());
    }
}
 
开发者ID:HujiangTechnology,项目名称:RestVolley,代码行数:19,代码来源:RestVolleyDownload.java

示例2: bindOkHttpClient

import com.squareup.okhttp.CertificatePinner; //导入依赖的package包/类
private void bindOkHttpClient() {
    mRequestEngine.okHttpClient.setSslSocketFactory(mSSLSocketFactory);
    mRequestEngine.okHttpClient.setHostnameVerifier(mHostnameVerifier);
    mRequestEngine.okHttpClient.setProxy(mProxy);
    mRequestEngine.okHttpClient.setConnectTimeout(mConnectTimeout, TimeUnit.MILLISECONDS);
    mRequestEngine.okHttpClient.setReadTimeout(mReadTimeout, TimeUnit.MILLISECONDS);
    mRequestEngine.okHttpClient.setWriteTimeout(mWriteTimeout, TimeUnit.MILLISECONDS);

    if (!mPinners.isEmpty()) {
        Set<Map.Entry<String, String>> sets = mPinners.entrySet();
        CertificatePinner.Builder cBuilder = new CertificatePinner.Builder();
        for (Map.Entry<String, String> entry : sets) {
            cBuilder.add(entry.getKey(), entry.getValue());
        }

        mRequestEngine.okHttpClient.setCertificatePinner(cBuilder.build());
    }
}
 
开发者ID:HujiangTechnology,项目名称:RestVolley,代码行数:19,代码来源:RestVolleyRequest.java

示例3: createHttpClient

import com.squareup.okhttp.CertificatePinner; //导入依赖的package包/类
/**
 * @return a new http client
 */
private OkHttpClient createHttpClient() {
    OkHttpClient client = new OkHttpClient();
    client.setReadTimeout(connectorOptions.getReadTimeout(), TimeUnit.SECONDS);
    client.setWriteTimeout(connectorOptions.getWriteTimeout(), TimeUnit.SECONDS);
    client.setConnectTimeout(connectorOptions.getConnectTimeout(), TimeUnit.SECONDS);
    client.setFollowRedirects(connectorOptions.isFollowRedirects());
    client.setFollowSslRedirects(connectorOptions.isFollowRedirects());
    client.setProxySelector(ProxySelector.getDefault());
    client.setCookieHandler(CookieHandler.getDefault());
    client.setCertificatePinner(CertificatePinner.DEFAULT);
    client.setAuthenticator(AuthenticatorAdapter.INSTANCE);
    client.setConnectionPool(ConnectionPool.getDefault());
    client.setProtocols(Util.immutableList(Protocol.HTTP_1_1));
    client.setConnectionSpecs(DEFAULT_CONNECTION_SPECS);
    client.setSocketFactory(SocketFactory.getDefault());
    Internal.instance.setNetwork(client, Network.DEFAULT);

    return client;
}
 
开发者ID:apiman,项目名称:apiman,代码行数:23,代码来源:HttpConnectorFactory.java

示例4: HawkularMetricsClient

import com.squareup.okhttp.CertificatePinner; //导入依赖的package包/类
/**
 * Constructor.
 * @param metricsServer
 */
public HawkularMetricsClient(URL metricsServer) {
    this.serverUrl = metricsServer;
    httpClient = new OkHttpClient();
    httpClient.setReadTimeout(DEFAULT_READ_TIMEOUT, TimeUnit.SECONDS);
    httpClient.setWriteTimeout(DEFAULT_WRITE_TIMEOUT, TimeUnit.SECONDS);
    httpClient.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT, TimeUnit.SECONDS);
    httpClient.setFollowRedirects(true);
    httpClient.setFollowSslRedirects(true);
    httpClient.setProxySelector(ProxySelector.getDefault());
    httpClient.setCookieHandler(CookieHandler.getDefault());
    httpClient.setCertificatePinner(CertificatePinner.DEFAULT);
    httpClient.setAuthenticator(AuthenticatorAdapter.INSTANCE);
    httpClient.setConnectionPool(ConnectionPool.getDefault());
    httpClient.setProtocols(Util.immutableList(Protocol.HTTP_1_1));
    httpClient.setConnectionSpecs(DEFAULT_CONNECTION_SPECS);
    httpClient.setSocketFactory(SocketFactory.getDefault());
    Internal.instance.setNetwork(httpClient, Network.DEFAULT);
}
 
开发者ID:apiman,项目名称:apiman,代码行数:23,代码来源:HawkularMetricsClient.java

示例5: createAddress

import com.squareup.okhttp.CertificatePinner; //导入依赖的package包/类
private static Address createAddress(OkHttpClient client, Request request) {
    SSLSocketFactory sslSocketFactory = null;
    HostnameVerifier hostnameVerifier = null;
    CertificatePinner certificatePinner = null;
    if (request.isHttps()) {
        sslSocketFactory = client.getSslSocketFactory();
        hostnameVerifier = client.getHostnameVerifier();
        certificatePinner = client.getCertificatePinner();
    }
    return new Address(request.httpUrl().host(), request.httpUrl().port(), client.getDns(),
            client.getSocketFactory(), sslSocketFactory, hostnameVerifier, certificatePinner, client.getAuthenticator(), client.getProxy(), client.getProtocols(), client.getConnectionSpecs(), client.getProxySelector());
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:HttpEngine.java


注:本文中的com.squareup.okhttp.CertificatePinner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。