Java 类org.apache.http.conn.scheme.SchemeSocketFactory 实例源码

项目:ribbon    文件:RestClient.java   
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());
        }
    }