本文整理汇总了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();
}
示例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);
}
示例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();
}
示例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);
}
示例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;
}