當前位置: 首頁>>代碼示例>>Java>>正文


Java JsseSSLManager類代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:ptrd,項目名稱:jmeter-websocket-samplers,代碼行數:26,代碼來源:WebSocketClient.java

示例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));
}
 
開發者ID:johrstrom,項目名稱:cloud-meter,代碼行數:10,代碼來源:SlowHC4SSLSocketFactory.java

示例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));
}
 
開發者ID:johrstrom,項目名稱:cloud-meter,代碼行數:9,代碼來源:HC4TrustAllSSLSocketFactory.java


注:本文中的org.apache.jmeter.util.JsseSSLManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。