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


Java ConnectionConfiguration.setSocketFactory方法代碼示例

本文整理匯總了Java中org.jivesoftware.smack.ConnectionConfiguration.setSocketFactory方法的典型用法代碼示例。如果您正苦於以下問題:Java ConnectionConfiguration.setSocketFactory方法的具體用法?Java ConnectionConfiguration.setSocketFactory怎麽用?Java ConnectionConfiguration.setSocketFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jivesoftware.smack.ConnectionConfiguration的用法示例。


在下文中一共展示了ConnectionConfiguration.setSocketFactory方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: LolChat

import org.jivesoftware.smack.ConnectionConfiguration; //導入方法依賴的package包/類
/**
 * Represents a single connection to a League of Legends chatserver.
 * 
 * @param server
 *            The chatserver of the region you want to connect to
 * @param friendRequestPolicy
 *            Determines how new Friend requests are treated.
 * @param riotApiKey
 *            Your apiKey used to convert summonerId's to name. You can get
 *            your key here <a
 *            href="https://developer.riotgames.com/">developer
 *            .riotgames.com</a>
 * 
 * @see LolChat#setFriendRequestPolicy(FriendRequestPolicy)
 * @see LolChat#setFriendRequestListener(FriendRequestListener)
 */
public LolChat(ChatServer server, FriendRequestPolicy friendRequestPolicy,
		RiotApiKey riotApiKey) {
	this.friendRequestPolicy = friendRequestPolicy;
	this.server = server;
	if (riotApiKey != null && server.api != null) {
		this.riotApi = RiotApi.build(riotApiKey, server);
	}
	Roster.setDefaultSubscriptionMode(SubscriptionMode.manual);
	final ConnectionConfiguration config = new ConnectionConfiguration(
			server.host, 5223, "pvp.net");
	config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled);
	config.setSocketFactory(SSLSocketFactory.getDefault());
	config.setCompressionEnabled(true);
	connection = new XMPPTCPConnection(config);

	addListeners();
}
 
開發者ID:TheHolyWaffle,項目名稱:League-of-Legends-XMPP-Chat-Library,代碼行數:34,代碼來源:LolChat.java

示例2: createConnection

import org.jivesoftware.smack.ConnectionConfiguration; //導入方法依賴的package包/類
/**
 * Creates a new XMPPTCPConnection using the connection preferences. This is useful when
 * not using a connection from the connection pool in a test case.
 *
 * @return a new XMPP connection.
 */
protected XMPPTCPConnection createConnection() {
    // Create the configuration for this new connection
    ConnectionConfiguration config = new ConnectionConfiguration(host, port);
    config.setCompressionEnabled(compressionEnabled);
    config.setSendPresence(sendInitialPresence());
    if (getSocketFactory() == null) {
        config.setSocketFactory(getSocketFactory());
    }
    return new XMPPTCPConnection(config);
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:17,代碼來源:SmackTestCase.java

示例3: LolChat

import org.jivesoftware.smack.ConnectionConfiguration; //導入方法依賴的package包/類
/**
 * Represents a single connection to a League of Legends chatserver.
 *
 * @param server              The chatserver of the region you want to connect to
 * @param friendRequestPolicy Determines how new Friend requests are treated.
 * @param riotApiKey          Your apiKey used to convert summonerId's to name. You can get
 *                            your key here <a
 *                            href="https://developer.riotgames.com/">developer
 *                            .riotgames.com</a>
 * @see LolChat#setFriendRequestPolicy(FriendRequestPolicy)
 * @see LolChat#setFriendRequestListener(FriendRequestListener)
 */
public LolChat(ChatServer server, FriendRequestPolicy friendRequestPolicy,
               String riotApiKey) {
    this.friendRequestPolicy = friendRequestPolicy;
    if (riotApiKey != null && server.api != null) {
        this.riotApi = new JRiot(riotApiKey, server.name().toLowerCase());
    }
    Roster.setDefaultSubscriptionMode(SubscriptionMode.manual);
    final ConnectionConfiguration config = new ConnectionConfiguration(
            server.host, 5223, "pvp.net");
    config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled);
    config.setSocketFactory(SSLSocketFactory.getDefault());
    config.setCompressionEnabled(true);
    connection = new XMPPTCPConnection(config);

    try {
        connection.connect();
    } catch (Exception e) {
        System.err.println("Failed to connect to " + server.host);
        return;
    }
    addListeners();
    new Thread(new Runnable() {

        @Override
        public void run() {
            while (!stop) {
                try {
                    Thread.sleep(500);//NOT SURE ABOUT THIS, TODO:REVIST
                } catch (final InterruptedException ignored) {
                }
            }
        }
    }).start();
}
 
開發者ID:tesfaye,項目名稱:LOL-Chat,代碼行數:47,代碼來源:LolChat.java

示例4: createConnection

import org.jivesoftware.smack.ConnectionConfiguration; //導入方法依賴的package包/類
/**
 * Creates a new XMPPConnection using the connection preferences. This is useful when
 * not using a connection from the connection pool in a test case.
 *
 * @return a new XMPP connection.
 */
protected XMPPConnection createConnection() {
    // Create the configuration for this new connection
    ConnectionConfiguration config = new ConnectionConfiguration(host, port);
    config.setCompressionEnabled(compressionEnabled);
    config.setSendPresence(sendInitialPresence());
    if (getSocketFactory() == null) {
        config.setSocketFactory(getSocketFactory());
    }
    return new XMPPConnection(config);
}
 
開發者ID:bejayoharen,項目名稱:java-bells,代碼行數:17,代碼來源:SmackTestCase.java

示例5: buildConnectionConfiguration

import org.jivesoftware.smack.ConnectionConfiguration; //導入方法依賴的package包/類
private static ConnectionConfiguration buildConnectionConfiguration(Shard shard) {
	ConnectionConfiguration connConf = new ConnectionConfiguration(shard.chatUrl, Shard.JABBER_PORT, "pvp.net");
	connConf.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
	connConf.setSocketFactory(SSLSocketFactory.getDefault());
	return connConf;
}
 
開發者ID:loldevs,項目名稱:riotapi,代碼行數:7,代碼來源:XmppClient.java


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