mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-16 23:16:33 +00:00
HTTPCLIENT-1182: constructor to org.apache.http.conn.ssl.SSLSocketFactory to allow for directly wrapping a javax.net.ssl.SSLSocketFactory socketfactory
Contributed by Mark Claassen <mclaassen at ocie.net> git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1311941 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
db9f011a83
commit
a9c95e057f
@ -242,7 +242,7 @@ private static SSLContext createSSLContext(
|
||||
sslcontext.init(keymanagers, trustmanagers, random);
|
||||
return sslcontext;
|
||||
}
|
||||
|
||||
|
||||
private static SSLContext createSystemSSLContext(
|
||||
String algorithm,
|
||||
final SecureRandom random) throws IOException, NoSuchAlgorithmException, NoSuchProviderException,
|
||||
@ -481,11 +481,28 @@ public SSLSocketFactory(
|
||||
public SSLSocketFactory(
|
||||
final SSLContext sslContext, final X509HostnameVerifier hostnameVerifier) {
|
||||
super();
|
||||
if (sslContext == null) {
|
||||
throw new IllegalArgumentException("SSL context may not be null");
|
||||
}
|
||||
this.socketfactory = sslContext.getSocketFactory();
|
||||
this.hostnameVerifier = hostnameVerifier;
|
||||
this.nameResolver = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.2
|
||||
*/
|
||||
public SSLSocketFactory(
|
||||
final javax.net.ssl.SSLSocketFactory socketfactory,
|
||||
final X509HostnameVerifier hostnameVerifier) {
|
||||
if (socketfactory == null) {
|
||||
throw new IllegalArgumentException("SSL socket factory may not be null");
|
||||
}
|
||||
this.socketfactory = socketfactory;
|
||||
this.hostnameVerifier = hostnameVerifier;
|
||||
this.nameResolver = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params Optional parameters. Parameters passed to this method will have no effect.
|
||||
* This method will create a unconnected instance of {@link Socket} class.
|
||||
|
Loading…
x
Reference in New Issue
Block a user