使用SSL在JMeter中进行HTTPS设置非常简单,但是相同的设置不适用于TCP Sampler,任何指针?
答案 0 :(得分:2)
目前JMeter TCP Sampler不支持SSL协议,您需要编写自己的实现或考虑切换到JSR223 Sampler。
用于创建SSL TCP连接的参考代码
import org.apache.jmeter.util.JsseSSLManager;
import org.apache.jmeter.util.SSLManager;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
int your_app_port = 1234;
String your_app_host = "localhost";
JsseSSLManager sslManager = (JsseSSLManager) SSLManager.getInstance();
SSLSocketFactory sslsocketfactory = sslManager.getContext().getSocketFactory();
SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket(your_app_host, your_app_port);
//do what you need with the SSL socket here
参考文献: