本文整理匯總了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));
}