本文整理汇总了Java中org.apache.jmeter.util.JsseSSLManager类的典型用法代码示例。如果您正苦于以下问题:Java JsseSSLManager类的具体用法?Java JsseSSLManager怎么用?Java JsseSSLManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsseSSLManager类属于org.apache.jmeter.util包,在下文中一共展示了JsseSSLManager类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSocket
import org.apache.jmeter.util.JsseSSLManager; //导入依赖的package包/类
protected Socket createSocket(String host, int port, int connectTimeout, int readTimeout) throws IOException {
Socket baseSocket = new Socket();
if (useProxy) {
log.debug("Using http proxy " + proxyHost + ":" + proxyPort + " for " + connectUrl);
setupProxyConnection(baseSocket, connectTimeout);
}
else
baseSocket.connect(new InetSocketAddress(host, port), connectTimeout);
if ("https".equals(connectUrl.getProtocol())) {
baseSocket.setSoTimeout(readTimeout);
JsseSSLManager sslMgr = (JsseSSLManager) SSLManager.getInstance();
try {
SSLSocketFactory tlsSocketFactory = sslMgr.getContext().getSocketFactory();
log.debug("Starting TLS connection.");
return tlsSocketFactory.createSocket(baseSocket, host, port, true);
} catch (GeneralSecurityException e) {
throw new IOException(e);
}
}
else {
return baseSocket;
}
}
示例2: SlowHC4SSLSocketFactory
import org.apache.jmeter.util.JsseSSLManager; //导入依赖的package包/类
/**
* Create a factory
* @param cps - characters per second, must be > 0
* @throws GeneralSecurityException if there's a problem setting up the security
* @throws IllegalArgumentException if cps ≤ 0
*/
public SlowHC4SSLSocketFactory(final int cps) throws GeneralSecurityException {
super(new HttpSSLProtocolSocketFactory((JsseSSLManager)JsseSSLManager.getInstance(), cps));
}
示例3: HC4TrustAllSSLSocketFactory
import org.apache.jmeter.util.JsseSSLManager; //导入依赖的package包/类
/**
* Create an SSL factory which trusts all certificates and hosts.
* {@link SSLSocketFactory#SSLSocketFactory(TrustStrategy, org.apache.http.conn.ssl.X509HostnameVerifier)}
* @throws GeneralSecurityException if there's a problem setting up the security
*/
public HC4TrustAllSSLSocketFactory() throws GeneralSecurityException {
this(new HttpSSLProtocolSocketFactory((JsseSSLManager)JsseSSLManager.getInstance(), JsseSSLManager.CPS));
}