Java Code Examples for org.jivesoftware.smack.ConnectionConfiguration#setDebuggerEnabled()

The following examples show how to use org.jivesoftware.smack.ConnectionConfiguration#setDebuggerEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmppManager.java    From weixin with Apache License 2.0 6 votes vote down vote up
/**
 * 与服务器建立连接
 * 
 * @return
 */
public boolean connectServer() {
	ConnectionConfiguration connConfig = new ConnectionConfiguration(xmppHost, Integer.parseInt(xmppPort));
	//设置安全模式
	connConfig.setSecurityMode(SecurityMode.required);
	//设置SASL认证是否启用
	connConfig.setSASLAuthenticationEnabled(false);
	//设置数据压缩是否启用
	connConfig.setCompressionEnabled(false);
	//是否启用调试模式
	connConfig.setDebuggerEnabled(true);

	/** 创建connection连接 */
	XMPPConnection connection = new XMPPConnection(connConfig);
	this.setConnection(connection);

	try {
		// 连接到服务器
		connection.connect();
		L.i(LOGTAG, "XMPP connected successfully");
		return true;
	} catch (XMPPException e) {
		L.e(LOGTAG, "XMPP connection failed", e);
	}
	return false;
}
 
Example 2
Source File: XmppTool.java    From xmpp with Apache License 2.0 5 votes vote down vote up
/**
 * <b>function:</b> ��ʼSmack��openfire���������ӵĻ�������
 * 
 * @author hoojo
 * @createDate 2012-6-25 ����04:06:42
 */

public static void init() {
	try {
		// connection = new XMPPConnection(server);
		// connection.connect();

		/**
		 * 5222��openfire������Ĭ�ϵ�ͨ�Ŷ˿ڣ�����Ե�¼http://192.168.8.32:9090/
		 * ������Ա����̨�鿴�ͻ��˵��������˿�
		 */
		config = new ConnectionConfiguration(server, 5222);

		/** �Ƿ�����ѹ�� */
		config.setCompressionEnabled(true);
		/** �Ƿ����ð�ȫ��֤ */
		config.setSASLAuthenticationEnabled(false);
		/** �Ƿ����õ��� */
		config.setDebuggerEnabled(false);
		// config.setReconnectionAllowed(true);
		// config.setRosterLoadedAtLogin(true);

		/** ����connection���� */
		connection = new XMPPConnection(config);
		/** �������� */
		connection.connect();
	} catch (XMPPException e) {
		e.printStackTrace();
	}
	// fail(connection);
	// fail(connection.getConnectionID());
}
 
Example 3
Source File: ClientConService.java    From weixin with Apache License 2.0 5 votes vote down vote up
public boolean login(String account, String password) {
	ConnectionConfiguration connConfig = new ConnectionConfiguration(xmppHost, Integer.parseInt(xmppPort));
	//设置安全模式
	connConfig.setSecurityMode(SecurityMode.required);
	//设置SASL认证是否启用
	connConfig.setSASLAuthenticationEnabled(false);
	//设置数据压缩是否启用
	connConfig.setCompressionEnabled(false);
	//是否启用调试模式
	connConfig.setDebuggerEnabled(true);

	/** 创建connection连接 */
	XMPPConnection connection = new XMPPConnection(connConfig);
	setConnection(connection);

	try {
		// 连接到服务器
		connection.connect();
		L.i(LOGTAG, "XMPP connected successfully");

		//登陆
		connection.login(account, password);

		/** 开启读写线程,并加入到管理类中 */
		//ClientSendThread cst = new ClientSendThread(connection);
		//cst.start();
		//ManageClientThread.addClientSendThread(account,cst);

		return true;
	} catch (XMPPException e) {
		L.e(LOGTAG, "XMPP connection failed", e);
	}
	return false;
}