mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 05:52:06 +01:00
s/XMPPConnection/TCPConnection
This commit is contained in:
parent
07649cc758
commit
84a3fd7bd9
25 changed files with 114 additions and 114 deletions
|
@ -37,7 +37,7 @@ public class LoginTest extends SmackTestCase {
|
||||||
*/
|
*/
|
||||||
public void testInvalidLogin() {
|
public void testInvalidLogin() {
|
||||||
try {
|
try {
|
||||||
XMPPConnection connection = createConnection();
|
TCPConnection connection = createConnection();
|
||||||
connection.connect();
|
connection.connect();
|
||||||
try {
|
try {
|
||||||
// Login with an invalid user
|
// Login with an invalid user
|
||||||
|
@ -67,8 +67,8 @@ public class LoginTest extends SmackTestCase {
|
||||||
if (!isTestAnonymousLogin()) return;
|
if (!isTestAnonymousLogin()) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
XMPPConnection conn1 = createConnection();
|
TCPConnection conn1 = createConnection();
|
||||||
XMPPConnection conn2 = createConnection();
|
TCPConnection conn2 = createConnection();
|
||||||
conn1.connect();
|
conn1.connect();
|
||||||
conn2.connect();
|
conn2.connect();
|
||||||
try {
|
try {
|
||||||
|
@ -106,12 +106,12 @@ public class LoginTest extends SmackTestCase {
|
||||||
try {
|
try {
|
||||||
ConnectionConfiguration config = new ConnectionConfiguration(getHost(), getPort());
|
ConnectionConfiguration config = new ConnectionConfiguration(getHost(), getPort());
|
||||||
config.setSASLAuthenticationEnabled(false);
|
config.setSASLAuthenticationEnabled(false);
|
||||||
XMPPConnection conn1 = new XMPPConnection(config);
|
TCPConnection conn1 = new XMPPConnection(config);
|
||||||
conn1.connect();
|
conn1.connect();
|
||||||
|
|
||||||
config = new ConnectionConfiguration(getHost(), getPort());
|
config = new ConnectionConfiguration(getHost(), getPort());
|
||||||
config.setSASLAuthenticationEnabled(false);
|
config.setSASLAuthenticationEnabled(false);
|
||||||
XMPPConnection conn2 = new XMPPConnection(config);
|
TCPConnection conn2 = new XMPPConnection(config);
|
||||||
conn2.connect();
|
conn2.connect();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -143,7 +143,7 @@ public class LoginTest extends SmackTestCase {
|
||||||
*/
|
*/
|
||||||
public void testLoginWithNoResource() {
|
public void testLoginWithNoResource() {
|
||||||
try {
|
try {
|
||||||
XMPPConnection conn = createConnection();
|
TCPConnection conn = createConnection();
|
||||||
conn.connect();
|
conn.connect();
|
||||||
try {
|
try {
|
||||||
conn.getAccountManager().createAccount("user_1", "user_1", getAccountCreationParameters());
|
conn.getAccountManager().createAccount("user_1", "user_1", getAccountCreationParameters());
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class MessageTest extends SmackTestCase {
|
||||||
// Create another connection for the same user of connection 1
|
// Create another connection for the same user of connection 1
|
||||||
ConnectionConfiguration connectionConfiguration =
|
ConnectionConfiguration connectionConfiguration =
|
||||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||||
XMPPConnection conn3 = new XMPPConnection(connectionConfiguration);
|
TCPConnection conn3 = new XMPPConnection(connectionConfiguration);
|
||||||
conn3.connect();
|
conn3.connect();
|
||||||
conn3.login(getUsername(0), getPassword(0), "Home");
|
conn3.login(getUsername(0), getPassword(0), "Home");
|
||||||
// Set this connection as highest priority
|
// Set this connection as highest priority
|
||||||
|
@ -243,7 +243,7 @@ public class MessageTest extends SmackTestCase {
|
||||||
// Create another connection for the same user of connection 1
|
// Create another connection for the same user of connection 1
|
||||||
ConnectionConfiguration connectionConfiguration =
|
ConnectionConfiguration connectionConfiguration =
|
||||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||||
XMPPConnection conn3 = new XMPPConnection(connectionConfiguration);
|
TCPConnection conn3 = new XMPPConnection(connectionConfiguration);
|
||||||
conn3.connect();
|
conn3.connect();
|
||||||
conn3.login(getUsername(0), getPassword(0), "Home");
|
conn3.login(getUsername(0), getPassword(0), "Home");
|
||||||
// Set this connection as highest priority
|
// Set this connection as highest priority
|
||||||
|
@ -292,7 +292,7 @@ public class MessageTest extends SmackTestCase {
|
||||||
// Create another connection for the same user of connection 1
|
// Create another connection for the same user of connection 1
|
||||||
ConnectionConfiguration connectionConfiguration =
|
ConnectionConfiguration connectionConfiguration =
|
||||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||||
XMPPConnection conn3 = new XMPPConnection(connectionConfiguration);
|
TCPConnection conn3 = new XMPPConnection(connectionConfiguration);
|
||||||
conn3.connect();
|
conn3.connect();
|
||||||
conn3.login(getUsername(0), getPassword(0), "Home");
|
conn3.login(getUsername(0), getPassword(0), "Home");
|
||||||
// Set this connection as highest priority
|
// Set this connection as highest priority
|
||||||
|
@ -308,7 +308,7 @@ public class MessageTest extends SmackTestCase {
|
||||||
|
|
||||||
connectionConfiguration =
|
connectionConfiguration =
|
||||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||||
XMPPConnection conn4 = new XMPPConnection(connectionConfiguration);
|
TCPConnection conn4 = new XMPPConnection(connectionConfiguration);
|
||||||
conn4.connect();
|
conn4.connect();
|
||||||
conn4.login(getUsername(0), getPassword(0), "Home2");
|
conn4.login(getUsername(0), getPassword(0), "Home2");
|
||||||
presence = new Presence(Presence.Type.available);
|
presence = new Presence(Presence.Type.available);
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class PresenceTest extends SmackTestCase {
|
||||||
* Connection(1) has logged from two different places with different presence priorities.
|
* Connection(1) has logged from two different places with different presence priorities.
|
||||||
*/
|
*/
|
||||||
public void testMessageToHighestPriority() {
|
public void testMessageToHighestPriority() {
|
||||||
XMPPConnection conn = null;
|
TCPConnection conn = null;
|
||||||
try {
|
try {
|
||||||
// User_1 will log in again using another resource
|
// User_1 will log in again using another resource
|
||||||
conn = createConnection();
|
conn = createConnection();
|
||||||
|
@ -142,7 +142,7 @@ public class PresenceTest extends SmackTestCase {
|
||||||
getConnection(1).sendPacket(new Presence(Presence.Type.unavailable));
|
getConnection(1).sendPacket(new Presence(Presence.Type.unavailable));
|
||||||
|
|
||||||
// User_1 will log in again using another resource (that is going to be available)
|
// User_1 will log in again using another resource (that is going to be available)
|
||||||
XMPPConnection conn = createConnection();
|
TCPConnection conn = createConnection();
|
||||||
conn.connect();
|
conn.connect();
|
||||||
conn.login(getUsername(1), getPassword(1), "OtherPlace");
|
conn.login(getUsername(1), getPassword(1), "OtherPlace");
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ public class PresenceTest extends SmackTestCase {
|
||||||
// Create another connection for the same user of connection 1
|
// Create another connection for the same user of connection 1
|
||||||
ConnectionConfiguration connectionConfiguration =
|
ConnectionConfiguration connectionConfiguration =
|
||||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||||
XMPPConnection conn4 = new XMPPConnection(connectionConfiguration);
|
TCPConnection conn4 = new XMPPConnection(connectionConfiguration);
|
||||||
conn4.connect();
|
conn4.connect();
|
||||||
conn4.login(getUsername(1), getPassword(1), "Home");
|
conn4.login(getUsername(1), getPassword(1), "Home");
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ public class PresenceTest extends SmackTestCase {
|
||||||
getConnection(0).disconnect();
|
getConnection(0).disconnect();
|
||||||
|
|
||||||
// See if conneciton 0 can get offline status.
|
// See if conneciton 0 can get offline status.
|
||||||
XMPPConnection con0 = getConnection(0);
|
TCPConnection con0 = getConnection(0);
|
||||||
con0.connect();
|
con0.connect();
|
||||||
con0.login(getUsername(0), getUsername(0));
|
con0.login(getUsername(0), getUsername(0));
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ public class ReconnectionTest extends SmackTestCase {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void testAutomaticReconnection() throws Exception {
|
public void testAutomaticReconnection() throws Exception {
|
||||||
XMPPConnection connection = getConnection(0);
|
TCPConnection connection = getConnection(0);
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
XMPPConnectionTestListener listener = new XMPPConnectionTestListener(latch);
|
TCPConnectionTestListener listener = new XMPPConnectionTestListener(latch);
|
||||||
connection.addConnectionListener(listener);
|
connection.addConnectionListener(listener);
|
||||||
|
|
||||||
// Simulates an error in the connection
|
// Simulates an error in the connection
|
||||||
|
@ -63,7 +63,7 @@ public class ReconnectionTest extends SmackTestCase {
|
||||||
config.setCompressionEnabled(true);
|
config.setCompressionEnabled(true);
|
||||||
config.setSASLAuthenticationEnabled(true);
|
config.setSASLAuthenticationEnabled(true);
|
||||||
|
|
||||||
XMPPConnection connection = new XMPPConnection(config);
|
TCPConnection connection = new XMPPConnection(config);
|
||||||
// Connect to the server
|
// Connect to the server
|
||||||
connection.connect();
|
connection.connect();
|
||||||
// Log into the server
|
// Log into the server
|
||||||
|
@ -75,7 +75,7 @@ public class ReconnectionTest extends SmackTestCase {
|
||||||
executeSomeServerInteraction(connection);
|
executeSomeServerInteraction(connection);
|
||||||
|
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
XMPPConnectionTestListener listener = new XMPPConnectionTestListener(latch);
|
TCPConnectionTestListener listener = new XMPPConnectionTestListener(latch);
|
||||||
connection.addConnectionListener(listener);
|
connection.addConnectionListener(listener);
|
||||||
|
|
||||||
// Simulates an error in the connection
|
// Simulates an error in the connection
|
||||||
|
@ -95,9 +95,9 @@ public class ReconnectionTest extends SmackTestCase {
|
||||||
* Simulates a connection error, disables the reconnection mechanism and then reconnects.
|
* Simulates a connection error, disables the reconnection mechanism and then reconnects.
|
||||||
*/
|
*/
|
||||||
public void testManualReconnectionWithCancelation() throws Exception {
|
public void testManualReconnectionWithCancelation() throws Exception {
|
||||||
XMPPConnection connection = getConnection(0);
|
TCPConnection connection = getConnection(0);
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
XMPPConnectionTestListener listener = new XMPPConnectionTestListener(latch);
|
TCPConnectionTestListener listener = new XMPPConnectionTestListener(latch);
|
||||||
connection.addConnectionListener(listener);
|
connection.addConnectionListener(listener);
|
||||||
|
|
||||||
// Produces a connection error
|
// Produces a connection error
|
||||||
|
@ -126,10 +126,10 @@ public class ReconnectionTest extends SmackTestCase {
|
||||||
* Closes the connection and then reconnects.
|
* Closes the connection and then reconnects.
|
||||||
*/
|
*/
|
||||||
public void testCloseAndManualReconnection() throws Exception {
|
public void testCloseAndManualReconnection() throws Exception {
|
||||||
XMPPConnection connection = getConnection(0);
|
TCPConnection connection = getConnection(0);
|
||||||
String username = connection.getConfiguration().getUsername();
|
String username = connection.getConfiguration().getUsername();
|
||||||
String password = connection.getConfiguration().getPassword();
|
String password = connection.getConfiguration().getPassword();
|
||||||
XMPPConnectionTestListener listener = new XMPPConnectionTestListener();
|
TCPConnectionTestListener listener = new XMPPConnectionTestListener();
|
||||||
connection.addConnectionListener(listener);
|
connection.addConnectionListener(listener);
|
||||||
|
|
||||||
// Produces a normal disconnection
|
// Produces a normal disconnection
|
||||||
|
@ -154,9 +154,9 @@ public class ReconnectionTest extends SmackTestCase {
|
||||||
* Closes the connection and then reconnects.
|
* Closes the connection and then reconnects.
|
||||||
*/
|
*/
|
||||||
public void testAnonymousReconnection() throws Exception {
|
public void testAnonymousReconnection() throws Exception {
|
||||||
XMPPConnection connection = createConnection();
|
TCPConnection connection = createConnection();
|
||||||
connection.connect();
|
connection.connect();
|
||||||
XMPPConnectionTestListener listener = new XMPPConnectionTestListener();
|
TCPConnectionTestListener listener = new XMPPConnectionTestListener();
|
||||||
connection.addConnectionListener(listener);
|
connection.addConnectionListener(listener);
|
||||||
|
|
||||||
// Makes the anounymous login
|
// Makes the anounymous login
|
||||||
|
@ -172,13 +172,13 @@ public class ReconnectionTest extends SmackTestCase {
|
||||||
assertEquals("Failed the manual connection", true, connection.isAnonymous());
|
assertEquals("Failed the manual connection", true, connection.isAnonymous());
|
||||||
}
|
}
|
||||||
|
|
||||||
private XMPPConnection createXMPPConnection() throws Exception {
|
private TCPConnection createXMPPConnection() throws Exception {
|
||||||
XMPPConnection connection;
|
TCPConnection connection;
|
||||||
// Create the configuration
|
// Create the configuration
|
||||||
ConnectionConfiguration config = new ConnectionConfiguration(getHost(), getPort());
|
ConnectionConfiguration config = new ConnectionConfiguration(getHost(), getPort());
|
||||||
config.setCompressionEnabled(Boolean.getBoolean("test.compressionEnabled"));
|
config.setCompressionEnabled(Boolean.getBoolean("test.compressionEnabled"));
|
||||||
config.setSASLAuthenticationEnabled(true);
|
config.setSASLAuthenticationEnabled(true);
|
||||||
connection = new XMPPConnection(config);
|
connection = new TCPConnection(config);
|
||||||
|
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ public class ReconnectionTest extends SmackTestCase {
|
||||||
/**
|
/**
|
||||||
* Execute some server interaction in order to test that the regenerated connection works fine.
|
* Execute some server interaction in order to test that the regenerated connection works fine.
|
||||||
*/
|
*/
|
||||||
private void executeSomeServerInteraction(XMPPConnection connection) throws XMPPException {
|
private void executeSomeServerInteraction(TCPConnection connection) throws XMPPException {
|
||||||
PingManager pingManager = PingManager.getInstanceFor(connection);
|
PingManager pingManager = PingManager.getInstanceFor(connection);
|
||||||
pingManager.pingMyServer();
|
pingManager.pingMyServer();
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ public class ReconnectionTest extends SmackTestCase {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class XMPPConnectionTestListener implements ConnectionListener {
|
private class TCPConnectionTestListener implements ConnectionListener {
|
||||||
|
|
||||||
// Variables to support listener notifications verification
|
// Variables to support listener notifications verification
|
||||||
private volatile boolean connectionClosed = false;
|
private volatile boolean connectionClosed = false;
|
||||||
|
@ -207,11 +207,11 @@ public class ReconnectionTest extends SmackTestCase {
|
||||||
private volatile boolean reconnectionCanceled = false;
|
private volatile boolean reconnectionCanceled = false;
|
||||||
private CountDownLatch countDownLatch;
|
private CountDownLatch countDownLatch;
|
||||||
|
|
||||||
private XMPPConnectionTestListener(CountDownLatch latch) {
|
private TCPConnectionTestListener(CountDownLatch latch) {
|
||||||
countDownLatch = latch;
|
countDownLatch = latch;
|
||||||
}
|
}
|
||||||
|
|
||||||
private XMPPConnectionTestListener() {
|
private TCPConnectionTestListener() {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Methods to test the listener.
|
* Methods to test the listener.
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class RosterInitializedBeforeConnectTest extends RosterSmackTest {
|
||||||
|
|
||||||
// initialize all rosters before login
|
// initialize all rosters before login
|
||||||
for (int i = 0; i < getMaxConnections(); i++) {
|
for (int i = 0; i < getMaxConnections(); i++) {
|
||||||
XMPPConnection connection = getConnection(i);
|
TCPConnection connection = getConnection(i);
|
||||||
assertFalse(connection.isConnected());
|
assertFalse(connection.isConnected());
|
||||||
|
|
||||||
Roster roster = connection.getRoster();
|
Roster roster = connection.getRoster();
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class RosterListenerTest extends SmackTestCase {
|
||||||
public void testAddingRosterListenerBeforeConnect() throws Exception {
|
public void testAddingRosterListenerBeforeConnect() throws Exception {
|
||||||
int inviterIndex = 0;
|
int inviterIndex = 0;
|
||||||
int inviteeIndex = 1;
|
int inviteeIndex = 1;
|
||||||
XMPPConnection inviterConnection = getConnection(inviterIndex);
|
TCPConnection inviterConnection = getConnection(inviterIndex);
|
||||||
connectAndLogin(inviterIndex);
|
connectAndLogin(inviterIndex);
|
||||||
|
|
||||||
assertTrue("Inviter is not online", inviterConnection.isConnected());
|
assertTrue("Inviter is not online", inviterConnection.isConnected());
|
||||||
|
@ -46,7 +46,7 @@ public class RosterListenerTest extends SmackTestCase {
|
||||||
// add user1 to roster to create roster events stored at XMPP server
|
// add user1 to roster to create roster events stored at XMPP server
|
||||||
inviterRoster.createEntry(getBareJID(inviteeIndex), getUsername(inviteeIndex), null);
|
inviterRoster.createEntry(getBareJID(inviteeIndex), getUsername(inviteeIndex), null);
|
||||||
|
|
||||||
XMPPConnection inviteeConnection = getConnection(inviteeIndex);
|
TCPConnection inviteeConnection = getConnection(inviteeIndex);
|
||||||
assertFalse("Invitee is already online", inviteeConnection.isConnected());
|
assertFalse("Invitee is already online", inviteeConnection.isConnected());
|
||||||
|
|
||||||
// collector for added entries
|
// collector for added entries
|
||||||
|
@ -88,7 +88,7 @@ public class RosterListenerTest extends SmackTestCase {
|
||||||
public void testAddingRosterListenerAfterConnect() throws Exception {
|
public void testAddingRosterListenerAfterConnect() throws Exception {
|
||||||
int inviterIndex = 0;
|
int inviterIndex = 0;
|
||||||
int inviteeIndex = 1;
|
int inviteeIndex = 1;
|
||||||
XMPPConnection inviterConnection = getConnection(inviterIndex);
|
TCPConnection inviterConnection = getConnection(inviterIndex);
|
||||||
connectAndLogin(inviterIndex);
|
connectAndLogin(inviterIndex);
|
||||||
assertTrue("Inviter is not online", inviterConnection.isConnected());
|
assertTrue("Inviter is not online", inviterConnection.isConnected());
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class RosterListenerTest extends SmackTestCase {
|
||||||
|
|
||||||
Thread.sleep(500); // wait for XMPP server
|
Thread.sleep(500); // wait for XMPP server
|
||||||
|
|
||||||
XMPPConnection inviteeConnection = getConnection(inviteeIndex);
|
TCPConnection inviteeConnection = getConnection(inviteeIndex);
|
||||||
connectAndLogin(inviteeIndex);
|
connectAndLogin(inviteeIndex);
|
||||||
assertTrue("Invitee is not online", inviteeConnection.isConnected());
|
assertTrue("Invitee is not online", inviteeConnection.isConnected());
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ public class RosterSmackTest extends SmackTestCase {
|
||||||
|
|
||||||
|
|
||||||
// Log in from another resource so we can test the roster
|
// Log in from another resource so we can test the roster
|
||||||
XMPPConnection con2 = createConnection();
|
TCPConnection con2 = createConnection();
|
||||||
con2.connect();
|
con2.connect();
|
||||||
con2.login(getUsername(0), getUsername(0), "MyNewResource");
|
con2.login(getUsername(0), getUsername(0), "MyNewResource");
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ public class RosterSmackTest extends SmackTestCase {
|
||||||
// Create another connection for the same user of connection 1
|
// Create another connection for the same user of connection 1
|
||||||
ConnectionConfiguration connectionConfiguration =
|
ConnectionConfiguration connectionConfiguration =
|
||||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||||
XMPPConnection conn4 = new XMPPConnection(connectionConfiguration);
|
TCPConnection conn4 = new XMPPConnection(connectionConfiguration);
|
||||||
conn4.connect();
|
conn4.connect();
|
||||||
conn4.login(getUsername(1), getPassword(1), "Home");
|
conn4.login(getUsername(1), getPassword(1), "Home");
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ public class RosterSmackTest extends SmackTestCase {
|
||||||
// Create another connection for the same user of connection 1
|
// Create another connection for the same user of connection 1
|
||||||
ConnectionConfiguration connectionConfiguration =
|
ConnectionConfiguration connectionConfiguration =
|
||||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||||
XMPPConnection conn4 = new XMPPConnection(connectionConfiguration);
|
TCPConnection conn4 = new XMPPConnection(connectionConfiguration);
|
||||||
conn4.connect();
|
conn4.connect();
|
||||||
conn4.login(getUsername(1), getPassword(1), "Home");
|
conn4.login(getUsername(1), getPassword(1), "Home");
|
||||||
|
|
||||||
|
@ -567,7 +567,7 @@ public class RosterSmackTest extends SmackTestCase {
|
||||||
// Create another connection for the same user of connection 0
|
// Create another connection for the same user of connection 0
|
||||||
ConnectionConfiguration connectionConfiguration =
|
ConnectionConfiguration connectionConfiguration =
|
||||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||||
XMPPConnection conn2 = new XMPPConnection(connectionConfiguration);
|
TCPConnection conn2 = new XMPPConnection(connectionConfiguration);
|
||||||
conn2.connect();
|
conn2.connect();
|
||||||
conn2.login(getUsername(0), getPassword(0), "Home");
|
conn2.login(getUsername(0), getPassword(0), "Home");
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import javax.net.SocketFactory;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.jivesoftware.smack.ConnectionConfiguration;
|
import org.jivesoftware.smack.ConnectionConfiguration;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.TCPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.util.ConnectionUtils;
|
import org.jivesoftware.smack.util.ConnectionUtils;
|
||||||
import org.xmlpull.v1.XmlPullParserFactory;
|
import org.xmlpull.v1.XmlPullParserFactory;
|
||||||
|
@ -70,7 +70,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
private String chatDomain = "chat";
|
private String chatDomain = "chat";
|
||||||
private String mucDomain = "conference";
|
private String mucDomain = "conference";
|
||||||
|
|
||||||
private XMPPConnection[] connections = null;
|
private TCPConnection[] connections = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SmackTestCase.
|
* Constructor for SmackTestCase.
|
||||||
|
@ -120,7 +120,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the XMPPConnection located at the requested position. Each test case holds a
|
* Returns the TCPConnection located at the requested position. Each test case holds a
|
||||||
* pool of connections which is initialized while setting up the test case. The maximum
|
* pool of connections which is initialized while setting up the test case. The maximum
|
||||||
* number of connections is controlled by the message {@link #getMaxConnections()} which
|
* number of connections is controlled by the message {@link #getMaxConnections()} which
|
||||||
* every subclass must implement.<p>
|
* every subclass must implement.<p>
|
||||||
|
@ -129,9 +129,9 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
* IllegalArgumentException will be thrown.
|
* IllegalArgumentException will be thrown.
|
||||||
*
|
*
|
||||||
* @param index the position in the pool of the connection to look for.
|
* @param index the position in the pool of the connection to look for.
|
||||||
* @return the XMPPConnection located at the requested position.
|
* @return the TCPConnection located at the requested position.
|
||||||
*/
|
*/
|
||||||
protected XMPPConnection getConnection(int index) {
|
protected TCPConnection getConnection(int index) {
|
||||||
if (index > getMaxConnections()) {
|
if (index > getMaxConnections()) {
|
||||||
throw new IllegalArgumentException("Index out of bounds");
|
throw new IllegalArgumentException("Index out of bounds");
|
||||||
}
|
}
|
||||||
|
@ -139,12 +139,12 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new XMPPConnection using the connection preferences. This is useful when
|
* Creates a new TCPConnection using the connection preferences. This is useful when
|
||||||
* not using a connection from the connection pool in a test case.
|
* not using a connection from the connection pool in a test case.
|
||||||
*
|
*
|
||||||
* @return a new XMPP connection.
|
* @return a new XMPP connection.
|
||||||
*/
|
*/
|
||||||
protected XMPPConnection createConnection() {
|
protected TCPConnection createConnection() {
|
||||||
// Create the configuration for this new connection
|
// Create the configuration for this new connection
|
||||||
ConnectionConfiguration config = new ConnectionConfiguration(host, port);
|
ConnectionConfiguration config = new ConnectionConfiguration(host, port);
|
||||||
config.setCompressionEnabled(compressionEnabled);
|
config.setCompressionEnabled(compressionEnabled);
|
||||||
|
@ -152,7 +152,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
if (getSocketFactory() == null) {
|
if (getSocketFactory() == null) {
|
||||||
config.setSocketFactory(getSocketFactory());
|
config.setSocketFactory(getSocketFactory());
|
||||||
}
|
}
|
||||||
return new XMPPConnection(config);
|
return new TCPConnection(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,7 +235,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
if (getMaxConnections() < 1) {
|
if (getMaxConnections() < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connections = new XMPPConnection[getMaxConnections()];
|
connections = new TCPConnection[getMaxConnections()];
|
||||||
usernames = new String[getMaxConnections()];
|
usernames = new String[getMaxConnections()];
|
||||||
passwords = new String[getMaxConnections()];
|
passwords = new String[getMaxConnections()];
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
if (passwordPrefix != null)
|
if (passwordPrefix != null)
|
||||||
password = (samePassword ? passwordPrefix : passwordPrefix + (connectionIndex + 1));
|
password = (samePassword ? passwordPrefix : passwordPrefix + (connectionIndex + 1));
|
||||||
|
|
||||||
XMPPConnection con = getConnection(connectionIndex);
|
TCPConnection con = getConnection(connectionIndex);
|
||||||
|
|
||||||
if (!con.isConnected())
|
if (!con.isConnected())
|
||||||
con.connect();
|
con.connect();
|
||||||
|
@ -340,7 +340,7 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
try {
|
try {
|
||||||
// If not connected, connect so that we can delete the account.
|
// If not connected, connect so that we can delete the account.
|
||||||
if (!getConnection(i).isConnected()) {
|
if (!getConnection(i).isConnected()) {
|
||||||
XMPPConnection con = getConnection(i);
|
TCPConnection con = getConnection(i);
|
||||||
con.connect();
|
con.connect();
|
||||||
con.login(getUsername(i), getUsername(i));
|
con.login(getUsername(i), getUsername(i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,13 +49,13 @@ import org.jivesoftware.smack.packet.Presence;
|
||||||
/**
|
/**
|
||||||
* The abstract Connection class provides an interface for connections to a
|
* The abstract Connection class provides an interface for connections to a
|
||||||
* XMPP server and implements shared methods which are used by the
|
* XMPP server and implements shared methods which are used by the
|
||||||
* different types of connections (e.g. XMPPConnection or BoshConnection).
|
* different types of connections (e.g. TCPConnection or BoshConnection).
|
||||||
*
|
*
|
||||||
* To create a connection to a XMPP server a simple usage of this API might
|
* To create a connection to a XMPP server a simple usage of this API might
|
||||||
* look like the following:
|
* look like the following:
|
||||||
* <pre>
|
* <pre>
|
||||||
* // Create a connection to the igniterealtime.org XMPP server.
|
* // Create a connection to the igniterealtime.org XMPP server.
|
||||||
* Connection con = new XMPPConnection("igniterealtime.org");
|
* Connection con = new TCPConnection("igniterealtime.org");
|
||||||
* // Connect to the server
|
* // Connect to the server
|
||||||
* con.connect();
|
* con.connect();
|
||||||
* // Most servers require you to login before performing other tasks.
|
* // Most servers require you to login before performing other tasks.
|
||||||
|
@ -81,7 +81,7 @@ import org.jivesoftware.smack.packet.Presence;
|
||||||
* again. To stop the reconnection process, use {@link #disconnect()}. Once stopped
|
* again. To stop the reconnection process, use {@link #disconnect()}. Once stopped
|
||||||
* you can use {@link #connect()} to manually connect to the server.
|
* you can use {@link #connect()} to manually connect to the server.
|
||||||
*
|
*
|
||||||
* @see XMPPConnection
|
* @see TCPConnection
|
||||||
* @author Matt Tucker
|
* @author Matt Tucker
|
||||||
* @author Guenther Niess
|
* @author Guenther Niess
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class CompressionTest extends SmackTestCase {
|
||||||
config.setCompressionEnabled(true);
|
config.setCompressionEnabled(true);
|
||||||
config.setSASLAuthenticationEnabled(true);
|
config.setSASLAuthenticationEnabled(true);
|
||||||
|
|
||||||
XMPPConnection connection = new XMPPConnection(config);
|
TCPConnection connection = new XMPPConnection(config);
|
||||||
connection.connect();
|
connection.connect();
|
||||||
|
|
||||||
// Login with the test account
|
// Login with the test account
|
||||||
|
@ -84,7 +84,7 @@ public class CompressionTest extends SmackTestCase {
|
||||||
*/
|
*/
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
XMPPConnection setupConnection = new XMPPConnection(getServiceName());
|
TCPConnection setupConnection = new XMPPConnection(getServiceName());
|
||||||
setupConnection.connect();
|
setupConnection.connect();
|
||||||
if (!setupConnection.getAccountManager().supportsAccountCreation())
|
if (!setupConnection.getAccountManager().supportsAccountCreation())
|
||||||
fail("Server does not support account creation");
|
fail("Server does not support account creation");
|
||||||
|
@ -105,7 +105,7 @@ public class CompressionTest extends SmackTestCase {
|
||||||
*/
|
*/
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
XMPPConnection setupConnection = createConnection();
|
TCPConnection setupConnection = createConnection();
|
||||||
setupConnection.connect();
|
setupConnection.connect();
|
||||||
setupConnection.login("user0", "user0");
|
setupConnection.login("user0", "user0");
|
||||||
// Delete the created account for the test
|
// Delete the created account for the test
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx;
|
package org.jivesoftware.smackx;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.TCPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.test.SmackTestCase;
|
import org.jivesoftware.smack.test.SmackTestCase;
|
||||||
|
@ -30,8 +30,8 @@ public class LastActivityManagerTest extends SmackTestCase {
|
||||||
* answered and correct.
|
* answered and correct.
|
||||||
*/
|
*/
|
||||||
public void testOnline() {
|
public void testOnline() {
|
||||||
XMPPConnection conn0 = getConnection(0);
|
TCPConnection conn0 = getConnection(0);
|
||||||
XMPPConnection conn1 = getConnection(1);
|
TCPConnection conn1 = getConnection(1);
|
||||||
|
|
||||||
// Send a message as the last activity action from connection 1 to
|
// Send a message as the last activity action from connection 1 to
|
||||||
// connection 0
|
// connection 0
|
||||||
|
@ -65,8 +65,8 @@ public class LastActivityManagerTest extends SmackTestCase {
|
||||||
* This is a test to check if a denied LastActivity response is handled correctly.
|
* This is a test to check if a denied LastActivity response is handled correctly.
|
||||||
*/
|
*/
|
||||||
public void testOnlinePermisionDenied() {
|
public void testOnlinePermisionDenied() {
|
||||||
XMPPConnection conn0 = getConnection(0);
|
TCPConnection conn0 = getConnection(0);
|
||||||
XMPPConnection conn2 = getConnection(2);
|
TCPConnection conn2 = getConnection(2);
|
||||||
|
|
||||||
// Send a message as the last activity action from connection 2 to
|
// Send a message as the last activity action from connection 2 to
|
||||||
// connection 0
|
// connection 0
|
||||||
|
@ -95,7 +95,7 @@ public class LastActivityManagerTest extends SmackTestCase {
|
||||||
* lapsed time is answered and correct
|
* lapsed time is answered and correct
|
||||||
*/
|
*/
|
||||||
public void testLastLoggedOut() {
|
public void testLastLoggedOut() {
|
||||||
XMPPConnection conn0 = getConnection(0);
|
TCPConnection conn0 = getConnection(0);
|
||||||
|
|
||||||
LastActivity lastActivity = null;
|
LastActivity lastActivity = null;
|
||||||
try {
|
try {
|
||||||
|
@ -115,7 +115,7 @@ public class LastActivityManagerTest extends SmackTestCase {
|
||||||
* is answered and correct
|
* is answered and correct
|
||||||
*/
|
*/
|
||||||
public void testServerUptime() {
|
public void testServerUptime() {
|
||||||
XMPPConnection conn0 = getConnection(0);
|
TCPConnection conn0 = getConnection(0);
|
||||||
|
|
||||||
LastActivity lastActivity = null;
|
LastActivity lastActivity = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.jivesoftware.smackx.entitycaps;
|
||||||
|
|
||||||
import org.jivesoftware.smack.PacketListener;
|
import org.jivesoftware.smack.PacketListener;
|
||||||
import org.jivesoftware.smack.SmackConfiguration;
|
import org.jivesoftware.smack.SmackConfiguration;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.TCPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.filter.AndFilter;
|
import org.jivesoftware.smack.filter.AndFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
|
@ -17,8 +17,8 @@ public class EntityCapsTest extends SmackTestCase {
|
||||||
|
|
||||||
private static final String DISCOVER_TEST_FEATURE = "entityCapsTest";
|
private static final String DISCOVER_TEST_FEATURE = "entityCapsTest";
|
||||||
|
|
||||||
XMPPConnection con0;
|
TCPConnection con0;
|
||||||
XMPPConnection con1;
|
TCPConnection con1;
|
||||||
EntityCapsManager ecm0;
|
EntityCapsManager ecm0;
|
||||||
EntityCapsManager ecm1;
|
EntityCapsManager ecm1;
|
||||||
ServiceDiscoveryManager sdm0;
|
ServiceDiscoveryManager sdm0;
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.jivesoftware.smack.Connection;
|
||||||
import org.jivesoftware.smack.ConnectionConfiguration;
|
import org.jivesoftware.smack.ConnectionConfiguration;
|
||||||
import org.jivesoftware.smack.PacketCollector;
|
import org.jivesoftware.smack.PacketCollector;
|
||||||
import org.jivesoftware.smack.SmackConfiguration;
|
import org.jivesoftware.smack.SmackConfiguration;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.TCPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
|
@ -224,7 +224,7 @@ public class MultiUserChatTest extends SmackTestCase {
|
||||||
// Anonymous user joins the new room
|
// Anonymous user joins the new room
|
||||||
ConnectionConfiguration connectionConfiguration =
|
ConnectionConfiguration connectionConfiguration =
|
||||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||||
XMPPConnection anonConnection = new XMPPConnection(connectionConfiguration);
|
TCPConnection anonConnection = new XMPPConnection(connectionConfiguration);
|
||||||
anonConnection.connect();
|
anonConnection.connect();
|
||||||
anonConnection.loginAnonymously();
|
anonConnection.loginAnonymously();
|
||||||
MultiUserChat muc2 = new MultiUserChat(anonConnection, room);
|
MultiUserChat muc2 = new MultiUserChat(anonConnection, room);
|
||||||
|
@ -1732,12 +1732,12 @@ public class MultiUserChatTest extends SmackTestCase {
|
||||||
|
|
||||||
public void testManyResources() throws Exception {
|
public void testManyResources() throws Exception {
|
||||||
// Create 5 more connections for user2
|
// Create 5 more connections for user2
|
||||||
XMPPConnection[] conns = new XMPPConnection[5];
|
TCPConnection[] conns = new XMPPConnection[5];
|
||||||
for (int i = 0; i < conns.length; i++) {
|
for (int i = 0; i < conns.length; i++) {
|
||||||
ConnectionConfiguration connectionConfiguration =
|
ConnectionConfiguration connectionConfiguration =
|
||||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||||
connectionConfiguration.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
|
connectionConfiguration.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
|
||||||
conns[i] = new XMPPConnection(connectionConfiguration);
|
conns[i] = new TCPConnection(connectionConfiguration);
|
||||||
conns[i].connect();
|
conns[i].connect();
|
||||||
conns[i].login(getUsername(1), getPassword(1), "resource-" + i);
|
conns[i].login(getUsername(1), getPassword(1), "resource-" + i);
|
||||||
Thread.sleep(20);
|
Thread.sleep(20);
|
||||||
|
@ -1843,7 +1843,7 @@ public class MultiUserChatTest extends SmackTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
//XMPPConnection.DEBUG_ENABLED = false;
|
//TCPConnection.DEBUG_ENABLED = false;
|
||||||
super.setUp();
|
super.setUp();
|
||||||
room = "fruta124@" + getMUCDomain();
|
room = "fruta124@" + getMUCDomain();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.util.List;
|
||||||
* See the following code sample for saving Bookmarks:
|
* See the following code sample for saving Bookmarks:
|
||||||
* <p/>
|
* <p/>
|
||||||
* <pre>
|
* <pre>
|
||||||
* Connection con = new XMPPConnection("jabber.org");
|
* Connection con = new TCPConnection("jabber.org");
|
||||||
* con.login("john", "doe");
|
* con.login("john", "doe");
|
||||||
* Bookmarks bookmarks = new Bookmarks();
|
* Bookmarks bookmarks = new Bookmarks();
|
||||||
* <p/>
|
* <p/>
|
||||||
|
|
|
@ -54,7 +54,7 @@ import org.jivesoftware.smackx.iqlast.packet.LastActivity;
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Connection con = new XMPPConnection("jabber.org");
|
* Connection con = new TCPConnection("jabber.org");
|
||||||
* con.login("john", "doe");
|
* con.login("john", "doe");
|
||||||
* LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org/Smack");
|
* LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org/Smack");
|
||||||
* </pre>
|
* </pre>
|
||||||
|
|
|
@ -34,7 +34,7 @@ import java.util.List;
|
||||||
* searching (DataForms or No DataForms), but allows the user to simply use the DataForm model for both
|
* searching (DataForms or No DataForms), but allows the user to simply use the DataForm model for both
|
||||||
* types of support.
|
* types of support.
|
||||||
* <pre>
|
* <pre>
|
||||||
* Connection con = new XMPPConnection("jabber.org");
|
* Connection con = new TCPConnection("jabber.org");
|
||||||
* con.login("john", "doe");
|
* con.login("john", "doe");
|
||||||
* UserSearchManager search = new UserSearchManager(con, "users.jabber.org");
|
* UserSearchManager search = new UserSearchManager(con, "users.jabber.org");
|
||||||
* Form searchForm = search.getSearchForm();
|
* Form searchForm = search.getSearchForm();
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.jivesoftware.smackx.jingle.mediaimpl.demo;
|
package org.jivesoftware.smackx.jingle.mediaimpl.demo;
|
||||||
|
|
||||||
import org.jivesoftware.smack.Connection;
|
import org.jivesoftware.smack.Connection;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.TCPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smackx.jingle.JingleManager;
|
import org.jivesoftware.smackx.jingle.JingleManager;
|
||||||
import org.jivesoftware.smackx.jingle.JingleSession;
|
import org.jivesoftware.smackx.jingle.JingleSession;
|
||||||
|
@ -66,7 +66,7 @@ public class Demo extends JFrame {
|
||||||
jid = new JTextField("jeffw" + "@" + server + "/Smack");
|
jid = new JTextField("jeffw" + "@" + server + "/Smack");
|
||||||
}
|
}
|
||||||
|
|
||||||
xmppConnection = new XMPPConnection(server);
|
xmppConnection = new TCPConnection(server);
|
||||||
try {
|
try {
|
||||||
xmppConnection.connect();
|
xmppConnection.connect();
|
||||||
xmppConnection.login(user, pass);
|
xmppConnection.login(user, pass);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
package org.jivesoftware.smackx.jingle;
|
package org.jivesoftware.smackx.jingle;
|
||||||
|
|
||||||
import org.jivesoftware.smack.PacketListener;
|
import org.jivesoftware.smack.PacketListener;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.TCPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.filter.PacketFilter;
|
import org.jivesoftware.smack.filter.PacketFilter;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
|
@ -682,10 +682,10 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
|
|
||||||
resetCounter();
|
resetCounter();
|
||||||
|
|
||||||
XMPPConnection x0 = getConnection(0);
|
TCPConnection x0 = getConnection(0);
|
||||||
XMPPConnection x1 = getConnection(1);
|
TCPConnection x1 = getConnection(1);
|
||||||
|
|
||||||
XMPPConnection.DEBUG_ENABLED = true;
|
TCPConnection.DEBUG_ENABLED = true;
|
||||||
|
|
||||||
FixedResolver tr0 = new FixedResolver("127.0.0.1", 20080);
|
FixedResolver tr0 = new FixedResolver("127.0.0.1", 20080);
|
||||||
FixedTransportManager ftm0 = new FixedTransportManager(tr0);
|
FixedTransportManager ftm0 = new FixedTransportManager(tr0);
|
||||||
|
@ -797,8 +797,8 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
|
|
||||||
resetCounter();
|
resetCounter();
|
||||||
|
|
||||||
XMPPConnection x0 = getConnection(0);
|
TCPConnection x0 = getConnection(0);
|
||||||
XMPPConnection x1 = getConnection(1);
|
TCPConnection x1 = getConnection(1);
|
||||||
|
|
||||||
FixedResolver tr0 = new FixedResolver("127.0.0.1", 20004);
|
FixedResolver tr0 = new FixedResolver("127.0.0.1", 20004);
|
||||||
FixedTransportManager ftm0 = new FixedTransportManager(tr0);
|
FixedTransportManager ftm0 = new FixedTransportManager(tr0);
|
||||||
|
|
|
@ -17,7 +17,7 @@ package org.jivesoftware.smackx.jingle;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.TCPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.test.SmackTestCase;
|
import org.jivesoftware.smack.test.SmackTestCase;
|
||||||
import org.jivesoftware.smackx.jingle.listeners.JingleSessionRequestListener;
|
import org.jivesoftware.smackx.jingle.listeners.JingleSessionRequestListener;
|
||||||
|
@ -52,8 +52,8 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
|
|
||||||
public void testCompleteJmf() {
|
public void testCompleteJmf() {
|
||||||
|
|
||||||
XMPPConnection x0 = getConnection(0);
|
TCPConnection x0 = getConnection(0);
|
||||||
XMPPConnection x1 = getConnection(1);
|
TCPConnection x1 = getConnection(1);
|
||||||
|
|
||||||
for (int i = 0; i < 1; i++)
|
for (int i = 0; i < 1; i++)
|
||||||
try {
|
try {
|
||||||
|
@ -131,8 +131,8 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
XMPPConnection x0 = getConnection(0);
|
TCPConnection x0 = getConnection(0);
|
||||||
XMPPConnection x1 = getConnection(1);
|
TCPConnection x1 = getConnection(1);
|
||||||
|
|
||||||
ICETransportManager icetm0 = new ICETransportManager(x0, "jivesoftware.com", 3478);
|
ICETransportManager icetm0 = new ICETransportManager(x0, "jivesoftware.com", 3478);
|
||||||
ICETransportManager icetm1 = new ICETransportManager(x1, "jivesoftware.com", 3478);
|
ICETransportManager icetm1 = new ICETransportManager(x1, "jivesoftware.com", 3478);
|
||||||
|
@ -212,10 +212,10 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//XMPPConnection.DEBUG_ENABLED = true;
|
//TCPConnection.DEBUG_ENABLED = true;
|
||||||
|
|
||||||
XMPPConnection x0 = getConnection(0);
|
TCPConnection x0 = getConnection(0);
|
||||||
XMPPConnection x1 = getConnection(1);
|
TCPConnection x1 = getConnection(1);
|
||||||
|
|
||||||
JingleMediaManager jingleMediaManager0 = new SpeexMediaManager(new STUNTransportManager());
|
JingleMediaManager jingleMediaManager0 = new SpeexMediaManager(new STUNTransportManager());
|
||||||
JingleMediaManager jingleMediaManager1 = new SpeexMediaManager(new STUNTransportManager());
|
JingleMediaManager jingleMediaManager1 = new SpeexMediaManager(new STUNTransportManager());
|
||||||
|
@ -266,8 +266,8 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
XMPPConnection x0 = getConnection(0);
|
TCPConnection x0 = getConnection(0);
|
||||||
XMPPConnection x1 = getConnection(1);
|
TCPConnection x1 = getConnection(1);
|
||||||
|
|
||||||
ICETransportManager icetm0 = new ICETransportManager(x0, "stun.xten.net", 3478);
|
ICETransportManager icetm0 = new ICETransportManager(x0, "stun.xten.net", 3478);
|
||||||
ICETransportManager icetm1 = new ICETransportManager(x1, "stun.xten.net", 3478);
|
ICETransportManager icetm1 = new ICETransportManager(x1, "stun.xten.net", 3478);
|
||||||
|
@ -325,8 +325,8 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
XMPPConnection x0 = getConnection(n);
|
TCPConnection x0 = getConnection(n);
|
||||||
XMPPConnection x1 = getConnection(n + 1);
|
TCPConnection x1 = getConnection(n + 1);
|
||||||
|
|
||||||
BridgedTransportManager btm0 = new BridgedTransportManager(x0);
|
BridgedTransportManager btm0 = new BridgedTransportManager(x0);
|
||||||
BridgedTransportManager btm1 = new BridgedTransportManager(x1);
|
BridgedTransportManager btm1 = new BridgedTransportManager(x1);
|
||||||
|
@ -399,10 +399,10 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
public void testCompleteWithBridgeB() {
|
public void testCompleteWithBridgeB() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//XMPPConnection.DEBUG_ENABLED = true;
|
//TCPConnection.DEBUG_ENABLED = true;
|
||||||
|
|
||||||
XMPPConnection x0 = getConnection(0);
|
TCPConnection x0 = getConnection(0);
|
||||||
XMPPConnection x1 = getConnection(1);
|
TCPConnection x1 = getConnection(1);
|
||||||
|
|
||||||
BridgedTransportManager btm0 = new BridgedTransportManager(x0);
|
BridgedTransportManager btm0 = new BridgedTransportManager(x0);
|
||||||
BridgedTransportManager btm1 = new BridgedTransportManager(x1);
|
BridgedTransportManager btm1 = new BridgedTransportManager(x1);
|
||||||
|
|
|
@ -96,7 +96,7 @@ import org.jivesoftware.smackx.provider.JingleProvider;
|
||||||
* try {
|
* try {
|
||||||
* <p/>
|
* <p/>
|
||||||
* // Connect to a XMPP Server
|
* // Connect to a XMPP Server
|
||||||
* Connection x1 = new XMPPConnection("xmpp.com");
|
* Connection x1 = new TCPConnection("xmpp.com");
|
||||||
* x1.connect();
|
* x1.connect();
|
||||||
* x1.login("juliet", "juliet");
|
* x1.login("juliet", "juliet");
|
||||||
* <p/>
|
* <p/>
|
||||||
|
@ -139,7 +139,7 @@ import org.jivesoftware.smackx.provider.JingleProvider;
|
||||||
* try {
|
* try {
|
||||||
* <p/>
|
* <p/>
|
||||||
* // Connect to a XMPP Server
|
* // Connect to a XMPP Server
|
||||||
* Connection x0 = new XMPPConnection("xmpp.com");
|
* Connection x0 = new TCPConnection("xmpp.com");
|
||||||
* x0.connect();
|
* x0.connect();
|
||||||
* x0.login("romeo", "romeo");
|
* x0.login("romeo", "romeo");
|
||||||
* <p/>
|
* <p/>
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<%@ include file="global.jsp" %>
|
<%@ include file="global.jsp" %>
|
||||||
<%
|
<%
|
||||||
// If we don't have a valid connection then proceed to login
|
// If we don't have a valid connection then proceed to login
|
||||||
XMPPConnection conn = (XMPPConnection) session.getAttribute("connection");
|
TCPConnection conn = (XMPPConnection) session.getAttribute("connection");
|
||||||
if (conn == null || !conn.isConnected()) {
|
if (conn == null || !conn.isConnected()) {
|
||||||
response.sendRedirect("login.jsp");
|
response.sendRedirect("login.jsp");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
<%@ include file="global.jsp" %>
|
<%@ include file="global.jsp" %>
|
||||||
<%
|
<%
|
||||||
// If we already got a connection then proceed to view the roster
|
// If we already got a connection then proceed to view the roster
|
||||||
XMPPConnection conn = (XMPPConnection) session.getAttribute("connection");
|
TCPConnection conn = (XMPPConnection) session.getAttribute("connection");
|
||||||
if (conn != null && conn.isConnected()) {
|
if (conn != null && conn.isConnected()) {
|
||||||
response.sendRedirect("viewRoster.jsp");
|
response.sendRedirect("viewRoster.jsp");
|
||||||
return;
|
return;
|
||||||
|
@ -69,13 +69,13 @@
|
||||||
|
|
||||||
// Try to connect to the server
|
// Try to connect to the server
|
||||||
if (error == null && host != null && port != null) {
|
if (error == null && host != null && port != null) {
|
||||||
XMPPConnection.DEBUG_ENABLED = "Yes".equals(debug);
|
TCPConnection.DEBUG_ENABLED = "Yes".equals(debug);
|
||||||
try {
|
try {
|
||||||
if ("No".equals(ssl)) {
|
if ("No".equals(ssl)) {
|
||||||
conn = new XMPPConnection(host);
|
conn = new TCPConnection(host);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
conn = new XMPPConnection(host);
|
conn = new TCPConnection(host);
|
||||||
}
|
}
|
||||||
conn.connect();
|
conn.connect();
|
||||||
// Add listener for messages (offline messages will be listen here)
|
// Add listener for messages (offline messages will be listen here)
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<%@ include file="global.jsp" %>
|
<%@ include file="global.jsp" %>
|
||||||
<%
|
<%
|
||||||
// If we don't have a valid connection then proceed to login
|
// If we don't have a valid connection then proceed to login
|
||||||
XMPPConnection conn = (XMPPConnection) session.getAttribute("connection");
|
TCPConnection conn = (XMPPConnection) session.getAttribute("connection");
|
||||||
if (conn == null || !conn.isConnected()) {
|
if (conn == null || !conn.isConnected()) {
|
||||||
response.sendRedirect("login.jsp");
|
response.sendRedirect("login.jsp");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<%@ include file="global.jsp" %>
|
<%@ include file="global.jsp" %>
|
||||||
<%
|
<%
|
||||||
// If we don't have a valid connection then proceed to login
|
// If we don't have a valid connection then proceed to login
|
||||||
XMPPConnection conn = (XMPPConnection) session.getAttribute("connection");
|
TCPConnection conn = (XMPPConnection) session.getAttribute("connection");
|
||||||
if (conn == null || !conn.isConnected()) {
|
if (conn == null || !conn.isConnected()) {
|
||||||
response.sendRedirect("login.jsp");
|
response.sendRedirect("login.jsp");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class TCPConnection extends Connection {
|
||||||
private String user = null;
|
private String user = null;
|
||||||
private boolean connected = false;
|
private boolean connected = false;
|
||||||
// socketClosed is used concurrent
|
// socketClosed is used concurrent
|
||||||
// by XMPPConnection, PacketReader, PacketWriter
|
// by TCPConnection, PacketReader, PacketWriter
|
||||||
private volatile boolean socketClosed = false;
|
private volatile boolean socketClosed = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,9 +113,9 @@ public class TCPConnection extends Connection {
|
||||||
* <p/>
|
* <p/>
|
||||||
* This is the simplest constructor for connecting to an XMPP server. Alternatively,
|
* This is the simplest constructor for connecting to an XMPP server. Alternatively,
|
||||||
* you can get fine-grained control over connection settings using the
|
* you can get fine-grained control over connection settings using the
|
||||||
* {@link #XMPPConnection(ConnectionConfiguration)} constructor.<p>
|
* {@link #TCPConnection(ConnectionConfiguration)} constructor.<p>
|
||||||
* <p/>
|
* <p/>
|
||||||
* Note that XMPPConnection constructors do not establish a connection to the server
|
* Note that TCPConnection constructors do not establish a connection to the server
|
||||||
* and you must call {@link #connect()}.<p>
|
* and you must call {@link #connect()}.<p>
|
||||||
* <p/>
|
* <p/>
|
||||||
* The CallbackHandler will only be used if the connection requires the client provide
|
* The CallbackHandler will only be used if the connection requires the client provide
|
||||||
|
@ -134,7 +134,7 @@ public class TCPConnection extends Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new XMPP connection in the same way {@link #XMPPConnection(String,CallbackHandler)} does, but
|
* Creates a new XMPP connection in the same way {@link #TCPConnection(String,CallbackHandler)} does, but
|
||||||
* with no callback handler for password prompting of the keystore. This will work
|
* with no callback handler for password prompting of the keystore. This will work
|
||||||
* in most cases, provided the client is not required to provide a certificate to
|
* in most cases, provided the client is not required to provide a certificate to
|
||||||
* the server.
|
* the server.
|
||||||
|
@ -149,7 +149,7 @@ public class TCPConnection extends Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new XMPP connection in the same way {@link #XMPPConnection(ConnectionConfiguration,CallbackHandler)} does, but
|
* Creates a new XMPP connection in the same way {@link #TCPConnection(ConnectionConfiguration,CallbackHandler)} does, but
|
||||||
* with no callback handler for password prompting of the keystore. This will work
|
* with no callback handler for password prompting of the keystore. This will work
|
||||||
* in most cases, provided the client is not required to provide a certificate to
|
* in most cases, provided the client is not required to provide a certificate to
|
||||||
* the server.
|
* the server.
|
||||||
|
@ -166,9 +166,9 @@ public class TCPConnection extends Connection {
|
||||||
* <p/>
|
* <p/>
|
||||||
* Manually specifying connection configuration information is suitable for
|
* Manually specifying connection configuration information is suitable for
|
||||||
* advanced users of the API. In many cases, using the
|
* advanced users of the API. In many cases, using the
|
||||||
* {@link #XMPPConnection(String)} constructor is a better approach.<p>
|
* {@link #TCPConnection(String)} constructor is a better approach.<p>
|
||||||
* <p/>
|
* <p/>
|
||||||
* Note that XMPPConnection constructors do not establish a connection to the server
|
* Note that TCPConnection constructors do not establish a connection to the server
|
||||||
* and you must call {@link #connect()}.<p>
|
* and you must call {@link #connect()}.<p>
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue