org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(185)

本文整理了Java中org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory()方法的一些代码示例,展示了SSLSocketFactory.getSocketFactory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SSLSocketFactory.getSocketFactory()方法的具体详情如下:
包路径:org.apache.http.conn.ssl.SSLSocketFactory
类名称:SSLSocketFactory
方法名:getSocketFactory

SSLSocketFactory.getSocketFactory介绍

[英]Gets an singleton instance of the SSLProtocolSocketFactory.
[中]获取SSLProtocolSocketFactory的单例实例。

代码示例

代码示例来源:origin: k9mail/k-9

public WebDavSocketFactory(TrustManagerFactory trustManagerFactory, String host, int port) throws NoSuchAlgorithmException, KeyManagementException {
  SSLContext sslContext = SSLContext.getInstance("TLS");
  sslContext.init(null, new TrustManager[] {
      trustManagerFactory.getTrustManagerForDomain(host, port)
  }, null);
  mSocketFactory = sslContext.getSocketFactory();
  mSchemeSocketFactory = org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory();
  mSchemeSocketFactory.setHostnameVerifier(
      org.apache.http.conn.ssl.SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
}

代码示例来源:origin: androidquery/androidquery

registry.register(new Scheme("https", ssf == null ? SSLSocketFactory.getSocketFactory() : ssf, 443));

代码示例来源:origin: robovm/robovm

new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
registry.register(
    new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));

代码示例来源:origin: mttkay/ignition

protected void setupHttpClient() {
  BasicHttpParams httpParams = new BasicHttpParams();
  ConnManagerParams.setTimeout(httpParams, DEFAULT_WAIT_FOR_CONNECTION_TIMEOUT);
  ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(
      DEFAULT_MAX_CONNECTIONS));
  ConnManagerParams.setMaxTotalConnections(httpParams, DEFAULT_MAX_CONNECTIONS);
  HttpConnectionParams.setSoTimeout(httpParams, DEFAULT_SOCKET_TIMEOUT);
  HttpConnectionParams.setTcpNoDelay(httpParams, true);
  HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1);
  HttpProtocolParams.setUserAgent(httpParams, DEFAULT_HTTP_USER_AGENT);
  SchemeRegistry schemeRegistry = new SchemeRegistry();
  schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
  if (IgnitedDiagnostics.ANDROID_API_LEVEL >= 7) {
    schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
  } else {
    // used to work around a bug in Android 1.6:
    // http://code.google.com/p/android/issues/detail?id=1946
    // TODO: is there a less rigorous workaround for this?
    schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(), 443));
  }
  ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(httpParams, schemeRegistry);
  httpClient = new DefaultHttpClient(cm, httpParams);
}

代码示例来源:origin: rnewson/couchdb-lucene

.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 5984));
schemeRegistry
    .register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
final ClientConnectionManager cm = new ShieldedClientConnManager(
    new ThreadSafeClientConnManager(params, schemeRegistry));

代码示例来源:origin: aws-amplify/aws-sdk-android

public static ThreadSafeClientConnManager createThreadSafeClientConnManager(
      ClientConfiguration config, HttpParams httpClientParams) {
    ConnManagerParams.setMaxConnectionsPerRoute(httpClientParams,
        new ConnPerRouteBean(config.getMaxConnections()));
    ConnManagerParams.setMaxTotalConnections(httpClientParams, config.getMaxConnections());

    SSLSocketFactory sslSocketFactory = SSLSocketFactory.getSocketFactory();
    sslSocketFactory.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);

    SchemeRegistry registry = new SchemeRegistry();
    registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), DEFAULT_HTTP_PORT));
    registry.register(new Scheme("https", sslSocketFactory, DEFAULT_HTTPS_PORT));

    ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager(
        httpClientParams, registry);
    if (config.useReaper()) {
      IdleConnectionReaper.registerConnectionManager(connectionManager);
    }
    return connectionManager;
  }
}

代码示例来源:origin: soundcloud/java-api-wrapper

/**
 * @return SSL SocketFactory used by the underlying HttpClient
 */
protected SSLSocketFactory getSSLSocketFactory() {
  return SSLSocketFactory.getSocketFactory();
}

代码示例来源:origin: aws-amplify/aws-sdk-android

final SSLSocketFactory sslSocketFactory = SSLSocketFactory.getSocketFactory();
sslSocketFactory.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
final Scheme https = new Scheme("https", sslSocketFactory, HTTPS_PORT);

代码示例来源:origin: com.hynnet/httpclient

/**
 * Initializes default scheme registry based on JSSE defaults. System properties will
 * not be taken into consideration.
 */
public static SchemeRegistry createDefault() {
  final SchemeRegistry registry = new SchemeRegistry();
  registry.register(
      new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
  registry.register(
      new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
  return registry;
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Initializes default scheme registry based on JSSE defaults. System properties will
 * not be taken into consideration.
 */
public static SchemeRegistry createDefault() {
  final SchemeRegistry registry = new SchemeRegistry();
  registry.register(
      new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
  registry.register(
      new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
  return registry;
}

代码示例来源:origin: Nextdoor/bender

/**
 * Initializes default scheme registry based on JSSE defaults. System properties will
 * not be taken into consideration.
 */
public static SchemeRegistry createDefault() {
  final SchemeRegistry registry = new SchemeRegistry();
  registry.register(
      new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
  registry.register(
      new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
  return registry;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient

/**
 * Initializes default scheme registry based on JSSE defaults. System properties will
 * not be taken into consideration.
 */
public static SchemeRegistry createDefault() {
  final SchemeRegistry registry = new SchemeRegistry();
  registry.register(
      new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
  registry.register(
      new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
  return registry;
}

代码示例来源:origin: blazegraph/database

protected SchemeRegistry newSchemeRegistry() {
  
  final SchemeRegistry schemeRegistry = new SchemeRegistry();
  schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory
      .getSocketFactory()));
  
  schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory
      .getSocketFactory()));
  return schemeRegistry;
}
/**

代码示例来源:origin: taskadapter/redmine-java-api

/**
 * Creates default connection manager.
 */
public static ClientConnectionManager createDefaultConnectionManager() {
  return createConnectionManager(SSLSocketFactory.getSocketFactory());
}

代码示例来源:origin: com.atlassian.jira.plugins/bitbucket-client

private SchemeRegistry createDefaultSchemeRegistry() {
    SchemeRegistry registry = new SchemeRegistry();
    registry.register(
        new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
    registry.register(
        new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
    return registry;
  }
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange/intact-tasks

private HttpClient createHttpClient() {
  SchemeRegistry schemeRegistry = new SchemeRegistry();
  schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory
      .getSocketFactory()));
  schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory
      .getSocketFactory()));
  PoolingClientConnectionManager cm = new PoolingClientConnectionManager(schemeRegistry);
  cm.setMaxTotal(maxTotalConnections);
  cm.setDefaultMaxPerRoute(defaultMaxConnectionsPerHost);
  HttpClient httpClient = new DefaultHttpClient(cm);
  return httpClient;
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange/intact-tasks

private HttpClient createHttpClient() {
  SchemeRegistry schemeRegistry = new SchemeRegistry();
  schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory
      .getSocketFactory()));
  schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory
      .getSocketFactory()));
  PoolingClientConnectionManager cm = new PoolingClientConnectionManager(schemeRegistry);
  cm.setMaxTotal(maxTotalConnections);
  cm.setDefaultMaxPerRoute(defaultMaxConnectionsPerHost);
  HttpClient httpClient = new DefaultHttpClient(cm);
  return httpClient;
}

代码示例来源:origin: net.sf.jsog/jsog

/**
 * Constructs a new DefaultJsogClientImpl.
 */
public DefaultHttpClientImpl() {
  SchemeRegistry schemeRegistry = new SchemeRegistry();
  schemeRegistry.register(new Scheme(
      "http", PlainSocketFactory.getSocketFactory(), 80));
  schemeRegistry.register(new Scheme(
      "https", SSLSocketFactory.getSocketFactory(), 443));
  conman = new ThreadSafeClientConnManager(params, schemeRegistry);
}

代码示例来源:origin: openimaj/openimaj

private TwitterInputStreamFactory() throws FileNotFoundException, IOException {
  PicSlurper.loadConfig();
  this.params = new BasicHttpParams();
  HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
  HttpProtocolParams.setContentCharset(params, "utf-8");
  HttpConnectionParams.setConnectionTimeout(params, 1000);
  HttpConnectionParams.setSoTimeout(params, 1000);
  this.registry = new SchemeRegistry();
  registry.register(new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
}

代码示例来源:origin: blazegraph/database

protected SchemeRegistry newSchemeRegistry() {
  
  final SchemeRegistry schemeRegistry = new SchemeRegistry();
  schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory
      .getSocketFactory()));
  
  schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory
      .getSocketFactory()));
  return schemeRegistry;
}
/**

相关文章