本文整理匯總了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;
}