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


Java SchemeSocketFactory类代码示例

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


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

示例1: getKeyStore

import org.apache.http.conn.scheme.SchemeSocketFactory; //导入依赖的package包/类
public KeyStore getKeyStore(){

    	SchemeRegistry registry = httpClient4.getConnectionManager().getSchemeRegistry();

    	if(! registry.getSchemeNames().contains("https")){
    		throw new IllegalStateException("Registry does not include an 'https' entry.");
    	}

    	SchemeSocketFactory awareSocketFactory = httpClient4.getConnectionManager().getSchemeRegistry().getScheme("https").getSchemeSocketFactory();

    	if(awareSocketFactory instanceof KeyStoreAwareSocketFactory){
    		return ((KeyStoreAwareSocketFactory) awareSocketFactory).getKeyStore();
    	}else{
    		throw new IllegalStateException("Cannot extract keystore from scheme socket factory of type: " + awareSocketFactory.getClass().getName());
    	}
    }
 
开发者ID:Netflix,项目名称:ribbon,代码行数:17,代码来源:RestClient.java

示例2: DxHttpClient

import org.apache.http.conn.scheme.SchemeSocketFactory; //导入依赖的package包/类
/**
 * Creates the http client using a thread safe {@code PoolingClientConnectionManager}
 *
 * See http://hc.apache.org/httpcomponents-client-4.2.x/tutorial/html/connmgmt.html#d5e581
 *
 * @authors Paolo Di Tommaso <[email protected]>
 *
 * @return
 */
protected DxHttpClient() {
    log.debug("Creating DxHttpClient object");
    try {
        DxEnv env = DxEnv.getInstance();
        securityContext = env.getSecurityContext();
        apiserver = env.getApiserverPath();

        final String PROT = env.getApiserverProtocol();
        final String HOST = env.getApiserverHost();
        final int PORT = env.getApiserverPort();

        SchemeRegistry schemeRegistry = new SchemeRegistry();
        SchemeSocketFactory factory = "https".equals(PROT) ?  SSLSocketFactory.getSocketFactory() : PlainSocketFactory.getSocketFactory();
        schemeRegistry.register(new Scheme(PROT, PORT, factory));

        PoolingClientConnectionManager manager = new PoolingClientConnectionManager(schemeRegistry);
        manager.setMaxTotal(100);
        manager.setDefaultMaxPerRoute(10);

        manager.setMaxPerRoute(new HttpRoute(new HttpHost(HOST, PORT)), 50);

        httpclient = new DefaultHttpClient(manager);
    }
    catch( IOException e ) {
        throw new IllegalStateException(e);
    }


}
 
开发者ID:nextflow-io,项目名称:jdk7-dxfs,代码行数:39,代码来源:DxHttpClient.java


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