当前位置: 首页>>代码示例>>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;未经允许,请勿转载。