尝试在jmeter和xmpp服务器之间创建连接

时间:2016-01-08 09:47:55

标签: jmeter xmpp

尝试创建连接但显示错误。以下是Beanshell采样器代码。

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.ConnectionListener;

import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
import org.jivesoftware.smack.SASLAuthentication;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;

String jabberId = "admin";
String jabberPass = "12345";


String SERVER_ADDRESS = "xxx.xxx.xxx.xxx";
int    PORT =  5222;  // or any other port

String ServiceName = "Smack";

SASLAuthentication.blacklistSASLMechanism("DIGEST-MD5");
SASLAuthentication.unBlacklistSASLMechanism("PLAIN");

    XMPPTCPConnectionConfiguration config  =  XMPPTCPConnectionConfiguration.builder()
        .setCompressionEnabled(false)
           .setHost(SERVER_ADDRESS)
           .setServiceName(ServiceName)
           .setPort(DEFAULT_PORT)
        .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
           .setSendPresence(true)
         .setDebuggerEnabled(true)
           .build();

   XMPPTCPConnection con = new XMPPTCPConnection(config);

   int REPLY_TIMEOUT = 50000;  // 50 seconds, but can be shorter
   con.setPacketReplyTimeout(REPLY_TIMEOUT);
    //con = getConnection();
con.connect();
//con.login(jabberId,jabberPass);

以下是错误..

Response code: 500 Response message:
org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval
In file: inline evaluation of: ``public XMPPConnection doConnect(String userName,String password) {         XMPPConne . . . '' Encountered "( xxx.xxx .xxx" at line 7, column 60.

请告诉我它有什么问题。或者给我正确的代码将jmeter连接到xmpp服务器。

0 个答案:

没有答案