diff --git a/README.md b/README.md index 3949b1c4c..d5227b98a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Key Advantages : - Extremely simple to use, yet powerful API. Sending a text message to a user can be accomplished in only a few lines of code: ```java - XMPPConnection connection = new TCPConnection("jabber.org"); + XMPPConnection connection = new XMPPTCPConnection("jabber.org"); connection.connect(); connection.login("mtucker", "password"); Chat chat = ChatManager.getInstanceFor(connection) diff --git a/bosh/src/main/java/org/jivesoftware/smack/BOSHConfiguration.java b/bosh/src/main/java/org/jivesoftware/smack/BOSHConfiguration.java index 9d13850d8..3f24b3f0d 100644 --- a/bosh/src/main/java/org/jivesoftware/smack/BOSHConfiguration.java +++ b/bosh/src/main/java/org/jivesoftware/smack/BOSHConfiguration.java @@ -28,7 +28,7 @@ import org.jivesoftware.smack.util.dns.HostAddress; * Configuration to use while establishing the connection to the XMPP server via * HTTP binding. * - * @see BOSHConnection + * @see XMPPBOSHConnection * @author Guenther Niess */ public class BOSHConfiguration extends ConnectionConfiguration { diff --git a/bosh/src/main/java/org/jivesoftware/smack/BOSHPacketReader.java b/bosh/src/main/java/org/jivesoftware/smack/BOSHPacketReader.java index 0811106fd..201a866fb 100644 --- a/bosh/src/main/java/org/jivesoftware/smack/BOSHPacketReader.java +++ b/bosh/src/main/java/org/jivesoftware/smack/BOSHPacketReader.java @@ -40,7 +40,7 @@ import org.igniterealtime.jbosh.ComposableBody; */ public class BOSHPacketReader implements BOSHClientResponseListener { - private BOSHConnection connection; + private XMPPBOSHConnection connection; /** * Create a packet reader which listen on a BOSHConnection for received @@ -48,7 +48,7 @@ public class BOSHPacketReader implements BOSHClientResponseListener { * * @param connection the corresponding connection for the received packets. */ - public BOSHPacketReader(BOSHConnection connection) { + public BOSHPacketReader(XMPPBOSHConnection connection) { this.connection = connection; } @@ -62,10 +62,10 @@ public class BOSHPacketReader implements BOSHClientResponseListener { if (body != null) { try { if (connection.sessionID == null) { - connection.sessionID = body.getAttribute(BodyQName.create(BOSHConnection.BOSH_URI, "sid")); + connection.sessionID = body.getAttribute(BodyQName.create(XMPPBOSHConnection.BOSH_URI, "sid")); } if (connection.authID == null) { - connection.authID = body.getAttribute(BodyQName.create(BOSHConnection.BOSH_URI, "authid")); + connection.authID = body.getAttribute(BodyQName.create(XMPPBOSHConnection.BOSH_URI, "authid")); } final XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser(); parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, @@ -93,12 +93,12 @@ public class BOSHPacketReader implements BOSHClientResponseListener { challengeData)); } else if (parser.getName().equals("success")) { connection.send(ComposableBody.builder() - .setNamespaceDefinition("xmpp", BOSHConnection.XMPP_BOSH_NS) + .setNamespaceDefinition("xmpp", XMPPBOSHConnection.XMPP_BOSH_NS) .setAttribute( - BodyQName.createWithPrefix(BOSHConnection.XMPP_BOSH_NS, "restart", "xmpp"), + BodyQName.createWithPrefix(XMPPBOSHConnection.XMPP_BOSH_NS, "restart", "xmpp"), "true") .setAttribute( - BodyQName.create(BOSHConnection.BOSH_URI, "to"), + BodyQName.create(XMPPBOSHConnection.BOSH_URI, "to"), connection.getServiceName()) .build()); connection.getSASLAuthentication().authenticated(); diff --git a/bosh/src/main/java/org/jivesoftware/smack/BOSHConnection.java b/bosh/src/main/java/org/jivesoftware/smack/XMPPBOSHConnection.java similarity index 97% rename from bosh/src/main/java/org/jivesoftware/smack/BOSHConnection.java rename to bosh/src/main/java/org/jivesoftware/smack/XMPPBOSHConnection.java index 43d2da863..dca6246da 100644 --- a/bosh/src/main/java/org/jivesoftware/smack/BOSHConnection.java +++ b/bosh/src/main/java/org/jivesoftware/smack/XMPPBOSHConnection.java @@ -56,8 +56,8 @@ import org.igniterealtime.jbosh.ComposableBody; * @see XMPPConnection * @author Guenther Niess */ -public class BOSHConnection extends XMPPConnection { - private static final Logger LOGGER = Logger.getLogger(BOSHConnection.class.getName()); +public class XMPPBOSHConnection extends XMPPConnection { + private static final Logger LOGGER = Logger.getLogger(XMPPBOSHConnection.class.getName()); /** * The XMPP Over Bosh namespace. @@ -120,7 +120,7 @@ public class BOSHConnection extends XMPPConnection { * @param xmppDomain the XMPP service name * (e.g. domain.lt for the user alice@domain.lt) */ - public BOSHConnection(boolean https, String host, int port, String filePath, String xmppDomain) { + public XMPPBOSHConnection(boolean https, String host, int port, String filePath, String xmppDomain) { super(new BOSHConfiguration(https, host, port, filePath, xmppDomain)); this.config = (BOSHConfiguration) getConfiguration(); } @@ -130,7 +130,7 @@ public class BOSHConnection extends XMPPConnection { * * @param config The configuration which is used for this connection. */ - public BOSHConnection(BOSHConfiguration config) { + public XMPPBOSHConnection(BOSHConfiguration config) { super(config); this.config = config; } @@ -549,9 +549,9 @@ public class BOSHConnection extends XMPPConnection { */ private class BOSHConnectionListener implements BOSHClientConnListener { - private final BOSHConnection connection; + private final XMPPBOSHConnection connection; - public BOSHConnectionListener(BOSHConnection connection) { + public BOSHConnectionListener(XMPPBOSHConnection connection) { this.connection = connection; } diff --git a/core/src/integration-test/java/org/jivesoftware/smack/LoginTest.java b/core/src/integration-test/java/org/jivesoftware/smack/LoginTest.java index ed2e63820..750cd6c02 100644 --- a/core/src/integration-test/java/org/jivesoftware/smack/LoginTest.java +++ b/core/src/integration-test/java/org/jivesoftware/smack/LoginTest.java @@ -37,7 +37,7 @@ public class LoginTest extends SmackTestCase { */ public void testInvalidLogin() { try { - TCPConnection connection = createConnection(); + XMPPTCPConnection connection = createConnection(); connection.connect(); try { // Login with an invalid user @@ -67,8 +67,8 @@ public class LoginTest extends SmackTestCase { if (!isTestAnonymousLogin()) return; try { - TCPConnection conn1 = createConnection(); - TCPConnection conn2 = createConnection(); + XMPPTCPConnection conn1 = createConnection(); + XMPPTCPConnection conn2 = createConnection(); conn1.connect(); conn2.connect(); try { @@ -106,12 +106,12 @@ public class LoginTest extends SmackTestCase { try { ConnectionConfiguration config = new ConnectionConfiguration(getHost(), getPort()); config.setSASLAuthenticationEnabled(false); - TCPConnection conn1 = new XMPPConnection(config); + XMPPTCPConnection conn1 = new XMPPConnection(config); conn1.connect(); config = new ConnectionConfiguration(getHost(), getPort()); config.setSASLAuthenticationEnabled(false); - TCPConnection conn2 = new XMPPConnection(config); + XMPPTCPConnection conn2 = new XMPPConnection(config); conn2.connect(); try { @@ -143,7 +143,7 @@ public class LoginTest extends SmackTestCase { */ public void testLoginWithNoResource() { try { - TCPConnection conn = createConnection(); + XMPPTCPConnection conn = createConnection(); conn.connect(); try { conn.getAccountManager().createAccount("user_1", "user_1", getAccountCreationParameters()); diff --git a/core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java b/core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java index 0e7d8f0da..c9e77e17b 100644 --- a/core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java +++ b/core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java @@ -194,7 +194,7 @@ public class MessageTest extends SmackTestCase { // Create another connection for the same user of connection 1 ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(getHost(), getPort(), getServiceName()); - TCPConnection conn3 = new XMPPConnection(connectionConfiguration); + XMPPTCPConnection conn3 = new XMPPConnection(connectionConfiguration); conn3.connect(); conn3.login(getUsername(0), getPassword(0), "Home"); // 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 ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(getHost(), getPort(), getServiceName()); - TCPConnection conn3 = new XMPPConnection(connectionConfiguration); + XMPPTCPConnection conn3 = new XMPPConnection(connectionConfiguration); conn3.connect(); conn3.login(getUsername(0), getPassword(0), "Home"); // 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 ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(getHost(), getPort(), getServiceName()); - TCPConnection conn3 = new XMPPConnection(connectionConfiguration); + XMPPTCPConnection conn3 = new XMPPConnection(connectionConfiguration); conn3.connect(); conn3.login(getUsername(0), getPassword(0), "Home"); // Set this connection as highest priority @@ -308,7 +308,7 @@ public class MessageTest extends SmackTestCase { connectionConfiguration = new ConnectionConfiguration(getHost(), getPort(), getServiceName()); - TCPConnection conn4 = new XMPPConnection(connectionConfiguration); + XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration); conn4.connect(); conn4.login(getUsername(0), getPassword(0), "Home2"); presence = new Presence(Presence.Type.available); diff --git a/core/src/integration-test/java/org/jivesoftware/smack/PresenceTest.java b/core/src/integration-test/java/org/jivesoftware/smack/PresenceTest.java index a5ede9b4f..9537b087e 100644 --- a/core/src/integration-test/java/org/jivesoftware/smack/PresenceTest.java +++ b/core/src/integration-test/java/org/jivesoftware/smack/PresenceTest.java @@ -39,7 +39,7 @@ public class PresenceTest extends SmackTestCase { * XMPPConnection(1) has logged from two different places with different presence priorities. */ public void testMessageToHighestPriority() { - TCPConnection conn = null; + XMPPTCPConnection conn = null; try { // User_1 will log in again using another resource conn = createConnection(); @@ -142,7 +142,7 @@ public class PresenceTest extends SmackTestCase { getConnection(1).sendPacket(new Presence(Presence.Type.unavailable)); // User_1 will log in again using another resource (that is going to be available) - TCPConnection conn = createConnection(); + XMPPTCPConnection conn = createConnection(); conn.connect(); 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 ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(getHost(), getPort(), getServiceName()); - TCPConnection conn4 = new XMPPConnection(connectionConfiguration); + XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration); conn4.connect(); conn4.login(getUsername(1), getPassword(1), "Home"); @@ -257,7 +257,7 @@ public class PresenceTest extends SmackTestCase { getConnection(0).disconnect(); // See if conneciton 0 can get offline status. - TCPConnection con0 = getConnection(0); + XMPPTCPConnection con0 = getConnection(0); con0.connect(); con0.login(getUsername(0), getUsername(0)); diff --git a/core/src/integration-test/java/org/jivesoftware/smack/ReconnectionTest.java b/core/src/integration-test/java/org/jivesoftware/smack/ReconnectionTest.java index 748ea2cee..2347e1c62 100644 --- a/core/src/integration-test/java/org/jivesoftware/smack/ReconnectionTest.java +++ b/core/src/integration-test/java/org/jivesoftware/smack/ReconnectionTest.java @@ -40,9 +40,9 @@ public class ReconnectionTest extends SmackTestCase { */ public void testAutomaticReconnection() throws Exception { - TCPConnection connection = getConnection(0); + XMPPTCPConnection connection = getConnection(0); CountDownLatch latch = new CountDownLatch(1); - TCPConnectionTestListener listener = new XMPPConnectionTestListener(latch); + XMPPTCPConnectionTestListener listener = new XMPPConnectionTestListener(latch); connection.addConnectionListener(listener); // Simulates an error in the connection @@ -63,7 +63,7 @@ public class ReconnectionTest extends SmackTestCase { config.setCompressionEnabled(true); config.setSASLAuthenticationEnabled(true); - TCPConnection connection = new XMPPConnection(config); + XMPPTCPConnection connection = new XMPPConnection(config); // Connect to the server connection.connect(); // Log into the server @@ -75,7 +75,7 @@ public class ReconnectionTest extends SmackTestCase { executeSomeServerInteraction(connection); CountDownLatch latch = new CountDownLatch(1); - TCPConnectionTestListener listener = new XMPPConnectionTestListener(latch); + XMPPTCPConnectionTestListener listener = new XMPPConnectionTestListener(latch); connection.addConnectionListener(listener); // 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. */ public void testManualReconnectionWithCancelation() throws Exception { - TCPConnection connection = getConnection(0); + XMPPTCPConnection connection = getConnection(0); CountDownLatch latch = new CountDownLatch(1); - TCPConnectionTestListener listener = new XMPPConnectionTestListener(latch); + XMPPTCPConnectionTestListener listener = new XMPPConnectionTestListener(latch); connection.addConnectionListener(listener); // Produces a connection error @@ -126,10 +126,10 @@ public class ReconnectionTest extends SmackTestCase { * Closes the connection and then reconnects. */ public void testCloseAndManualReconnection() throws Exception { - TCPConnection connection = getConnection(0); + XMPPTCPConnection connection = getConnection(0); String username = connection.getConfiguration().getUsername(); String password = connection.getConfiguration().getPassword(); - TCPConnectionTestListener listener = new XMPPConnectionTestListener(); + XMPPTCPConnectionTestListener listener = new XMPPConnectionTestListener(); connection.addConnectionListener(listener); // Produces a normal disconnection @@ -154,9 +154,9 @@ public class ReconnectionTest extends SmackTestCase { * Closes the connection and then reconnects. */ public void testAnonymousReconnection() throws Exception { - TCPConnection connection = createConnection(); + XMPPTCPConnection connection = createConnection(); connection.connect(); - TCPConnectionTestListener listener = new XMPPConnectionTestListener(); + XMPPTCPConnectionTestListener listener = new XMPPConnectionTestListener(); connection.addConnectionListener(listener); // Makes the anounymous login @@ -172,13 +172,13 @@ public class ReconnectionTest extends SmackTestCase { assertEquals("Failed the manual connection", true, connection.isAnonymous()); } - private TCPConnection createXMPPConnection() throws Exception { - TCPConnection connection; + private XMPPTCPConnection createXMPPConnection() throws Exception { + XMPPTCPConnection connection; // Create the configuration ConnectionConfiguration config = new ConnectionConfiguration(getHost(), getPort()); config.setCompressionEnabled(Boolean.getBoolean("test.compressionEnabled")); config.setSASLAuthenticationEnabled(true); - connection = new TCPConnection(config); + connection = new XMPPTCPConnection(config); return connection; } @@ -195,7 +195,7 @@ public class ReconnectionTest extends SmackTestCase { return 1; } - private class TCPConnectionTestListener implements ConnectionListener { + private class XMPPTCPConnectionTestListener implements ConnectionListener { // Variables to support listener notifications verification private volatile boolean connectionClosed = false; @@ -207,11 +207,11 @@ public class ReconnectionTest extends SmackTestCase { private volatile boolean reconnectionCanceled = false; private CountDownLatch countDownLatch; - private TCPConnectionTestListener(CountDownLatch latch) { + private XMPPTCPConnectionTestListener(CountDownLatch latch) { countDownLatch = latch; } - private TCPConnectionTestListener() { + private XMPPTCPConnectionTestListener() { } /** * Methods to test the listener. diff --git a/core/src/integration-test/java/org/jivesoftware/smack/RosterInitializedBeforeConnectTest.java b/core/src/integration-test/java/org/jivesoftware/smack/RosterInitializedBeforeConnectTest.java index 9afdb353b..2549e5fba 100644 --- a/core/src/integration-test/java/org/jivesoftware/smack/RosterInitializedBeforeConnectTest.java +++ b/core/src/integration-test/java/org/jivesoftware/smack/RosterInitializedBeforeConnectTest.java @@ -35,7 +35,7 @@ public class RosterInitializedBeforeConnectTest extends RosterSmackTest { // initialize all rosters before login for (int i = 0; i < getMaxConnections(); i++) { - TCPConnection connection = getConnection(i); + XMPPTCPConnection connection = getConnection(i); assertFalse(connection.isConnected()); Roster roster = connection.getRoster(); diff --git a/core/src/integration-test/java/org/jivesoftware/smack/RosterListenerTest.java b/core/src/integration-test/java/org/jivesoftware/smack/RosterListenerTest.java index f59f847e3..62deaeb37 100644 --- a/core/src/integration-test/java/org/jivesoftware/smack/RosterListenerTest.java +++ b/core/src/integration-test/java/org/jivesoftware/smack/RosterListenerTest.java @@ -36,7 +36,7 @@ public class RosterListenerTest extends SmackTestCase { public void testAddingRosterListenerBeforeConnect() throws Exception { int inviterIndex = 0; int inviteeIndex = 1; - TCPConnection inviterConnection = getConnection(inviterIndex); + XMPPTCPConnection inviterConnection = getConnection(inviterIndex); connectAndLogin(inviterIndex); 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 inviterRoster.createEntry(getBareJID(inviteeIndex), getUsername(inviteeIndex), null); - TCPConnection inviteeConnection = getConnection(inviteeIndex); + XMPPTCPConnection inviteeConnection = getConnection(inviteeIndex); assertFalse("Invitee is already online", inviteeConnection.isConnected()); // collector for added entries @@ -88,7 +88,7 @@ public class RosterListenerTest extends SmackTestCase { public void testAddingRosterListenerAfterConnect() throws Exception { int inviterIndex = 0; int inviteeIndex = 1; - TCPConnection inviterConnection = getConnection(inviterIndex); + XMPPTCPConnection inviterConnection = getConnection(inviterIndex); connectAndLogin(inviterIndex); assertTrue("Inviter is not online", inviterConnection.isConnected()); @@ -99,7 +99,7 @@ public class RosterListenerTest extends SmackTestCase { Thread.sleep(500); // wait for XMPP server - TCPConnection inviteeConnection = getConnection(inviteeIndex); + XMPPTCPConnection inviteeConnection = getConnection(inviteeIndex); connectAndLogin(inviteeIndex); assertTrue("Invitee is not online", inviteeConnection.isConnected()); diff --git a/core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java b/core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java index 7beedd51b..0bb393901 100644 --- a/core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java +++ b/core/src/integration-test/java/org/jivesoftware/smack/RosterSmackTest.java @@ -329,7 +329,7 @@ public class RosterSmackTest extends SmackTestCase { // Log in from another resource so we can test the roster - TCPConnection con2 = createConnection(); + XMPPTCPConnection con2 = createConnection(); con2.connect(); 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 ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(getHost(), getPort(), getServiceName()); - TCPConnection conn4 = new XMPPConnection(connectionConfiguration); + XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration); conn4.connect(); 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 ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(getHost(), getPort(), getServiceName()); - TCPConnection conn4 = new XMPPConnection(connectionConfiguration); + XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration); conn4.connect(); 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 ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(getHost(), getPort(), getServiceName()); - TCPConnection conn2 = new XMPPConnection(connectionConfiguration); + XMPPTCPConnection conn2 = new XMPPConnection(connectionConfiguration); conn2.connect(); conn2.login(getUsername(0), getPassword(0), "Home"); diff --git a/core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java b/core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java index beffe6e10..e43d01df7 100644 --- a/core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java +++ b/core/src/integration-test/java/org/jivesoftware/smack/test/SmackTestCase.java @@ -70,7 +70,7 @@ public abstract class SmackTestCase extends TestCase { private String chatDomain = "chat"; private String mucDomain = "conference"; - private TCPConnection[] connections = null; + private XMPPTCPConnection[] connections = null; /** * Constructor for SmackTestCase. @@ -120,7 +120,7 @@ public abstract class SmackTestCase extends TestCase { } /** - * Returns the TCPConnection located at the requested position. Each test case holds a + * Returns the XMPPTCPConnection located at the requested position. Each test case holds a * 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 * every subclass must implement.

@@ -129,9 +129,9 @@ public abstract class SmackTestCase extends TestCase { * IllegalArgumentException will be thrown. * * @param index the position in the pool of the connection to look for. - * @return the TCPConnection located at the requested position. + * @return the XMPPTCPConnection located at the requested position. */ - protected TCPConnection getConnection(int index) { + protected XMPPTCPConnection getConnection(int index) { if (index > getMaxConnections()) { throw new IllegalArgumentException("Index out of bounds"); } @@ -139,12 +139,12 @@ public abstract class SmackTestCase extends TestCase { } /** - * Creates a new TCPConnection using the connection preferences. This is useful when + * 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 TCPConnection createConnection() { + protected XMPPTCPConnection createConnection() { // Create the configuration for this new connection ConnectionConfiguration config = new ConnectionConfiguration(host, port); config.setCompressionEnabled(compressionEnabled); @@ -152,7 +152,7 @@ public abstract class SmackTestCase extends TestCase { if (getSocketFactory() == null) { config.setSocketFactory(getSocketFactory()); } - return new TCPConnection(config); + return new XMPPTCPConnection(config); } /** @@ -235,7 +235,7 @@ public abstract class SmackTestCase extends TestCase { if (getMaxConnections() < 1) { return; } - connections = new TCPConnection[getMaxConnections()]; + connections = new XMPPTCPConnection[getMaxConnections()]; usernames = new String[getMaxConnections()]; passwords = new String[getMaxConnections()]; @@ -340,7 +340,7 @@ public abstract class SmackTestCase extends TestCase { try { // If not connected, connect so that we can delete the account. if (!getConnection(i).isConnected()) { - TCPConnection con = getConnection(i); + XMPPTCPConnection con = getConnection(i); con.connect(); con.login(getUsername(i), getUsername(i)); } diff --git a/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java index 83b2e2c8a..517d1c4a6 100644 --- a/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java +++ b/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java @@ -55,13 +55,13 @@ import org.jivesoftware.smack.packet.Presence; /** * The abstract XMPPConnection class provides an interface for connections to a * XMPP server and implements shared methods which are used by the - * different types of connections (e.g. TCPConnection or BoshConnection). + * different types of connections (e.g. XMPPTCPConnection or XMPPBOSHConnection). * * To create a connection to a XMPP server a simple usage of this API might * look like the following: *

  * // Create a connection to the igniterealtime.org XMPP server.
- * XMPPConnection con = new TCPConnection("igniterealtime.org");
+ * XMPPConnection con = new XMPPTCPConnection("igniterealtime.org");
  * // Connect to the server
  * con.connect();
  * // Most servers require you to login before performing other tasks.
diff --git a/extensions/src/integration-test/java/org/jivesoftware/smackx/CompressionTest.java b/extensions/src/integration-test/java/org/jivesoftware/smackx/CompressionTest.java
index 6c0e2af90..4b770ccc8 100644
--- a/extensions/src/integration-test/java/org/jivesoftware/smackx/CompressionTest.java
+++ b/extensions/src/integration-test/java/org/jivesoftware/smackx/CompressionTest.java
@@ -45,7 +45,7 @@ public class CompressionTest extends SmackTestCase {
         config.setCompressionEnabled(true);
         config.setSASLAuthenticationEnabled(true);
 
-        TCPConnection connection = new XMPPConnection(config);
+        XMPPTCPConnection connection = new XMPPConnection(config);
         connection.connect();
 
         // Login with the test account
@@ -84,7 +84,7 @@ public class CompressionTest extends SmackTestCase {
      */
     protected void setUp() throws Exception {
         super.setUp();
-        TCPConnection setupConnection = new XMPPConnection(getServiceName());
+        XMPPTCPConnection setupConnection = new XMPPConnection(getServiceName());
         setupConnection.connect();
         if (!setupConnection.getAccountManager().supportsAccountCreation())
             fail("Server does not support account creation");
@@ -105,7 +105,7 @@ public class CompressionTest extends SmackTestCase {
      */
     protected void tearDown() throws Exception {
         super.tearDown();
-        TCPConnection setupConnection = createConnection();
+        XMPPTCPConnection setupConnection = createConnection();
         setupConnection.connect();
         setupConnection.login("user0", "user0");
         // Delete the created account for the test
diff --git a/extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java b/extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java
index ff6e4675c..f388d9587 100644
--- a/extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java
+++ b/extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java
@@ -17,8 +17,8 @@ public class EntityCapsTest extends SmackTestCase {
 
     private static final String DISCOVER_TEST_FEATURE = "entityCapsTest";
 
-    TCPConnection con0;
-    TCPConnection con1;
+    XMPPTCPConnection con0;
+    XMPPTCPConnection con1;
     EntityCapsManager ecm0;
     EntityCapsManager ecm1;
     ServiceDiscoveryManager sdm0;
diff --git a/extensions/src/integration-test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java b/extensions/src/integration-test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java
index 2ce5ed188..f4ca9de6c 100644
--- a/extensions/src/integration-test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java
+++ b/extensions/src/integration-test/java/org/jivesoftware/smackx/muc/MultiUserChatTest.java
@@ -224,7 +224,7 @@ public class MultiUserChatTest extends SmackTestCase {
             // Anonymous user joins the new room
             ConnectionConfiguration connectionConfiguration =
                     new ConnectionConfiguration(getHost(), getPort(), getServiceName());
-            TCPConnection anonConnection = new XMPPConnection(connectionConfiguration);
+            XMPPTCPConnection anonConnection = new XMPPConnection(connectionConfiguration);
             anonConnection.connect();
             anonConnection.loginAnonymously();
             MultiUserChat muc2 = new MultiUserChat(anonConnection, room);
@@ -1732,12 +1732,12 @@ public class MultiUserChatTest extends SmackTestCase {
 
     public void testManyResources() throws Exception {
             // Create 5 more connections for user2
-            TCPConnection[] conns = new XMPPConnection[5];
+            XMPPTCPConnection[] conns = new XMPPConnection[5];
             for (int i = 0; i < conns.length; i++) {
                 ConnectionConfiguration connectionConfiguration =
                         new ConnectionConfiguration(getHost(), getPort(), getServiceName());
                 connectionConfiguration.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
-                conns[i] = new TCPConnection(connectionConfiguration);
+                conns[i] = new XMPPTCPConnection(connectionConfiguration);
                 conns[i].connect();
                 conns[i].login(getUsername(1), getPassword(1), "resource-" + i);
                 Thread.sleep(20);
diff --git a/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/Bookmarks.java b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/Bookmarks.java
index 71f63b164..af484c3b5 100644
--- a/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/Bookmarks.java
+++ b/extensions/src/main/java/org/jivesoftware/smackx/bookmarks/Bookmarks.java
@@ -33,7 +33,7 @@ import java.util.List;
  * See the following code sample for saving Bookmarks:
  * 

*

- * XMPPConnection con = new TCPConnection("jabber.org");
+ * XMPPConnection con = new XMPPTCPConnection("jabber.org");
  * con.login("john", "doe");
  * Bookmarks bookmarks = new Bookmarks();
  * 

diff --git a/extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java b/extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java index b1fa8331a..6229d9ac6 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java @@ -60,7 +60,7 @@ import org.jivesoftware.smackx.iqlast.packet.LastActivity; *

* *

- * XMPPConnection con = new TCPConnection("jabber.org");
+ * XMPPConnection con = new XMPPTCPConnection("jabber.org");
  * con.login("john", "doe");
  * LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org/Smack");
  * 
diff --git a/extensions/src/main/java/org/jivesoftware/smackx/search/UserSearchManager.java b/extensions/src/main/java/org/jivesoftware/smackx/search/UserSearchManager.java index 5714b4fe3..df552b584 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/search/UserSearchManager.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/search/UserSearchManager.java @@ -36,7 +36,7 @@ import java.util.List; * searching (DataForms or No DataForms), but allows the user to simply use the DataForm model for both * types of support. *
- * XMPPConnection con = new TCPConnection("jabber.org");
+ * XMPPConnection con = new XMPPTCPConnection("jabber.org");
  * con.login("john", "doe");
  * UserSearchManager search = new UserSearchManager(con, "users.jabber.org");
  * Form searchForm = search.getSearchForm();
diff --git a/jingle/src/demo/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java b/jingle/src/demo/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java
index bad3e8f99..8f41c4385 100644
--- a/jingle/src/demo/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java
+++ b/jingle/src/demo/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java
@@ -66,7 +66,7 @@ public class Demo extends JFrame {
             jid = new JTextField("jeffw" + "@" + server + "/Smack");
         }
 
-        xmppConnection = new TCPConnection(server);
+        xmppConnection = new XMPPTCPConnection(server);
         try {
             xmppConnection.connect();
             xmppConnection.login(user, pass);
diff --git a/jingle/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java b/jingle/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java
index d00926f70..c4c990c9f 100644
--- a/jingle/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java
+++ b/jingle/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleManagerTest.java
@@ -682,10 +682,10 @@ public class JingleManagerTest extends SmackTestCase {
 
         resetCounter();
         
-        TCPConnection x0 = getConnection(0);
-        TCPConnection x1 = getConnection(1);
+        XMPPTCPConnection x0 = getConnection(0);
+        XMPPTCPConnection x1 = getConnection(1);
 
-        TCPConnection.DEBUG_ENABLED = true;
+        XMPPTCPConnection.DEBUG_ENABLED = true;
 
         FixedResolver tr0 = new FixedResolver("127.0.0.1", 20080);
         FixedTransportManager ftm0 = new FixedTransportManager(tr0);
@@ -797,8 +797,8 @@ public class JingleManagerTest extends SmackTestCase {
 
         resetCounter();
         
-        TCPConnection x0 = getConnection(0);
-        TCPConnection x1 = getConnection(1);
+        XMPPTCPConnection x0 = getConnection(0);
+        XMPPTCPConnection x1 = getConnection(1);
 
         FixedResolver tr0 = new FixedResolver("127.0.0.1", 20004);
         FixedTransportManager ftm0 = new FixedTransportManager(tr0);
diff --git a/jingle/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleMediaTest.java b/jingle/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleMediaTest.java
index cdd4eacd8..e8217a32f 100644
--- a/jingle/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleMediaTest.java
+++ b/jingle/src/integration-test/java/org/jivesoftware/smackx/jingle/JingleMediaTest.java
@@ -52,8 +52,8 @@ public class JingleMediaTest extends SmackTestCase {
 
     public void testCompleteJmf() {
 
-        TCPConnection x0 = getConnection(0);
-        TCPConnection x1 = getConnection(1);
+        XMPPTCPConnection x0 = getConnection(0);
+        XMPPTCPConnection x1 = getConnection(1);
 
         for (int i = 0; i < 1; i++)
             try {
@@ -131,8 +131,8 @@ public class JingleMediaTest extends SmackTestCase {
 
         try {
 
-            TCPConnection x0 = getConnection(0);
-            TCPConnection x1 = getConnection(1);
+            XMPPTCPConnection x0 = getConnection(0);
+            XMPPTCPConnection x1 = getConnection(1);
 
             ICETransportManager icetm0 = new ICETransportManager(x0, "jivesoftware.com", 3478);
             ICETransportManager icetm1 = new ICETransportManager(x1, "jivesoftware.com", 3478);
@@ -214,8 +214,8 @@ public class JingleMediaTest extends SmackTestCase {
 
             //TCPConnection.DEBUG_ENABLED = true;
 
-            TCPConnection x0 = getConnection(0);
-            TCPConnection x1 = getConnection(1);
+            XMPPTCPConnection x0 = getConnection(0);
+            XMPPTCPConnection x1 = getConnection(1);
 
             JingleMediaManager jingleMediaManager0 = new SpeexMediaManager(new STUNTransportManager());
             JingleMediaManager jingleMediaManager1 = new SpeexMediaManager(new STUNTransportManager());
@@ -266,8 +266,8 @@ public class JingleMediaTest extends SmackTestCase {
 
         try {
 
-            TCPConnection x0 = getConnection(0);
-            TCPConnection x1 = getConnection(1);
+            XMPPTCPConnection x0 = getConnection(0);
+            XMPPTCPConnection x1 = getConnection(1);
 
              ICETransportManager icetm0 = new ICETransportManager(x0, "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() {
                     try {
 
-                        TCPConnection x0 = getConnection(n);
-                        TCPConnection x1 = getConnection(n + 1);
+                        XMPPTCPConnection x0 = getConnection(n);
+                        XMPPTCPConnection x1 = getConnection(n + 1);
    
                         BridgedTransportManager btm0 = new BridgedTransportManager(x0);
                         BridgedTransportManager btm1 = new BridgedTransportManager(x1);
@@ -401,8 +401,8 @@ public class JingleMediaTest extends SmackTestCase {
 
             //TCPConnection.DEBUG_ENABLED = true;
 
-            TCPConnection x0 = getConnection(0);
-            TCPConnection x1 = getConnection(1);
+            XMPPTCPConnection x0 = getConnection(0);
+            XMPPTCPConnection x1 = getConnection(1);
 
             BridgedTransportManager btm0 = new BridgedTransportManager(x0);
             BridgedTransportManager btm1 = new BridgedTransportManager(x1);
diff --git a/jingle/src/main/java/org/jivesoftware/smackx/jingle/JingleManager.java b/jingle/src/main/java/org/jivesoftware/smackx/jingle/JingleManager.java
index 05bf53f9f..8dca34d96 100644
--- a/jingle/src/main/java/org/jivesoftware/smackx/jingle/JingleManager.java
+++ b/jingle/src/main/java/org/jivesoftware/smackx/jingle/JingleManager.java
@@ -96,7 +96,7 @@ import org.jivesoftware.smackx.jingle.provider.JingleProvider;
  *                               try {
  * 

* // Connect to a XMPP Server - * XMPPConnection x1 = new TCPConnection("xmpp.com"); + * XMPPConnection x1 = new XMPPTCPConnection("xmpp.com"); * x1.connect(); * x1.login("juliet", "juliet"); *

@@ -139,7 +139,7 @@ import org.jivesoftware.smackx.jingle.provider.JingleProvider; * try { *

* // Connect to a XMPP Server - * XMPPConnection x0 = new TCPConnection("xmpp.com"); + * XMPPConnection x0 = new XMPPTCPConnection("xmpp.com"); * x0.connect(); * x0.login("romeo", "romeo"); *

diff --git a/resources/sample/web/addContact.jsp b/resources/sample/web/addContact.jsp index fe66f5b48..3d56e3b81 100644 --- a/resources/sample/web/addContact.jsp +++ b/resources/sample/web/addContact.jsp @@ -54,7 +54,7 @@ <%@ include file="global.jsp" %> <% // If we don't have a valid connection then proceed to login - TCPConnection conn = (XMPPConnection) session.getAttribute("connection"); + XMPPTCPConnection conn = (XMPPConnection) session.getAttribute("connection"); if (conn == null || !conn.isConnected()) { response.sendRedirect("login.jsp"); return; diff --git a/resources/sample/web/login.jsp b/resources/sample/web/login.jsp index f4cd4f8fd..68747e6c3 100644 --- a/resources/sample/web/login.jsp +++ b/resources/sample/web/login.jsp @@ -51,7 +51,7 @@ <%@ include file="global.jsp" %> <% // If we already got a connection then proceed to view the roster - TCPConnection conn = (XMPPConnection) session.getAttribute("connection"); + XMPPTCPConnection conn = (XMPPConnection) session.getAttribute("connection"); if (conn != null && conn.isConnected()) { response.sendRedirect("viewRoster.jsp"); return; @@ -69,13 +69,13 @@ // Try to connect to the server if (error == null && host != null && port != null) { - TCPConnection.DEBUG_ENABLED = "Yes".equals(debug); + XMPPTCPConnection.DEBUG_ENABLED = "Yes".equals(debug); try { if ("No".equals(ssl)) { - conn = new TCPConnection(host); + conn = new XMPPTCPConnection(host); } else { - conn = new TCPConnection(host); + conn = new XMPPTCPConnection(host); } conn.connect(); // Add listener for messages (offline messages will be listen here) diff --git a/resources/sample/web/moveContact.jsp b/resources/sample/web/moveContact.jsp index 2ef253ea7..16030504c 100644 --- a/resources/sample/web/moveContact.jsp +++ b/resources/sample/web/moveContact.jsp @@ -54,7 +54,7 @@ <%@ include file="global.jsp" %> <% // If we don't have a valid connection then proceed to login - TCPConnection conn = (XMPPConnection) session.getAttribute("connection"); + XMPPTCPConnection conn = (XMPPConnection) session.getAttribute("connection"); if (conn == null || !conn.isConnected()) { response.sendRedirect("login.jsp"); return; diff --git a/resources/sample/web/viewRoster.jsp b/resources/sample/web/viewRoster.jsp index ade52533a..8ecd9c90f 100644 --- a/resources/sample/web/viewRoster.jsp +++ b/resources/sample/web/viewRoster.jsp @@ -54,7 +54,7 @@ <%@ include file="global.jsp" %> <% // If we don't have a valid connection then proceed to login - TCPConnection conn = (XMPPConnection) session.getAttribute("connection"); + XMPPTCPConnection conn = (XMPPConnection) session.getAttribute("connection"); if (conn == null || !conn.isConnected()) { response.sendRedirect("login.jsp"); return; diff --git a/tcp/src/main/java/org/jivesoftware/smack/PacketReader.java b/tcp/src/main/java/org/jivesoftware/smack/PacketReader.java index 74543e43b..bc03d4b10 100644 --- a/tcp/src/main/java/org/jivesoftware/smack/PacketReader.java +++ b/tcp/src/main/java/org/jivesoftware/smack/PacketReader.java @@ -51,13 +51,13 @@ class PacketReader { private Thread readerThread; - private TCPConnection connection; + private XMPPTCPConnection connection; private XmlPullParser parser; volatile boolean done; private String connectionID = null; - protected PacketReader(final TCPConnection connection) { + protected PacketReader(final XMPPTCPConnection connection) { this.connection = connection; this.init(); } diff --git a/tcp/src/main/java/org/jivesoftware/smack/PacketWriter.java b/tcp/src/main/java/org/jivesoftware/smack/PacketWriter.java index b71169c08..d27d68dcd 100644 --- a/tcp/src/main/java/org/jivesoftware/smack/PacketWriter.java +++ b/tcp/src/main/java/org/jivesoftware/smack/PacketWriter.java @@ -41,7 +41,7 @@ class PacketWriter { private Thread writerThread; private Writer writer; - private TCPConnection connection; + private XMPPTCPConnection connection; private final BlockingQueue queue; volatile boolean done; @@ -50,7 +50,7 @@ class PacketWriter { * * @param connection the connection. */ - protected PacketWriter(TCPConnection connection) { + protected PacketWriter(XMPPTCPConnection connection) { this.queue = new ArrayBlockingQueue(500, true); this.connection = connection; init(); diff --git a/tcp/src/main/java/org/jivesoftware/smack/TCPConnection.java b/tcp/src/main/java/org/jivesoftware/smack/XMPPTCPConnection.java similarity index 97% rename from tcp/src/main/java/org/jivesoftware/smack/TCPConnection.java rename to tcp/src/main/java/org/jivesoftware/smack/XMPPTCPConnection.java index b4d65d372..5e8bc94da 100644 --- a/tcp/src/main/java/org/jivesoftware/smack/TCPConnection.java +++ b/tcp/src/main/java/org/jivesoftware/smack/XMPPTCPConnection.java @@ -63,7 +63,7 @@ import java.util.Locale; * @see XMPPConnection * @author Matt Tucker */ -public class TCPConnection extends XMPPConnection { +public class XMPPTCPConnection extends XMPPConnection { /** * The socket which is used for this connection. @@ -74,7 +74,7 @@ public class TCPConnection extends XMPPConnection { private String user = null; private boolean connected = false; // socketClosed is used concurrent - // by TCPConnection, PacketReader, PacketWriter + // by XMPPTCPConnection, PacketReader, PacketWriter private volatile boolean socketClosed = false; /** @@ -115,9 +115,9 @@ public class TCPConnection extends XMPPConnection { *

* This is the simplest constructor for connecting to an XMPP server. Alternatively, * you can get fine-grained control over connection settings using the - * {@link #TCPConnection(ConnectionConfiguration)} constructor.

+ * {@link #XMPPTCPConnection(ConnectionConfiguration)} constructor.

*

- * Note that TCPConnection constructors do not establish a connection to the server + * Note that XMPPTCPConnection constructors do not establish a connection to the server * and you must call {@link #connect()}.

*

* The CallbackHandler will only be used if the connection requires the client provide @@ -127,27 +127,27 @@ public class TCPConnection extends XMPPConnection { * @param serviceName the name of the XMPP server to connect to; e.g. example.com. * @param callbackHandler the CallbackHandler used to prompt for the password to the keystore. */ - public TCPConnection(String serviceName, CallbackHandler callbackHandler) { + public XMPPTCPConnection(String serviceName, CallbackHandler callbackHandler) { // Create the configuration for this new connection super(new ConnectionConfiguration(serviceName)); config.setCallbackHandler(callbackHandler); } /** - * Creates a new XMPP connection in the same way {@link #TCPConnection(String,CallbackHandler)} does, but + * Creates a new XMPP connection in the same way {@link #XMPPTCPConnection(String,CallbackHandler)} does, but * 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 * the server. * * @param serviceName the name of the XMPP server to connect to; e.g. example.com. */ - public TCPConnection(String serviceName) { + public XMPPTCPConnection(String serviceName) { // Create the configuration for this new connection super(new ConnectionConfiguration(serviceName)); } /** - * Creates a new XMPP connection in the same way {@link #TCPConnection(ConnectionConfiguration,CallbackHandler)} does, but + * Creates a new XMPP connection in the same way {@link #XMPPTCPConnection(ConnectionConfiguration,CallbackHandler)} does, but * 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 * the server. @@ -155,7 +155,7 @@ public class TCPConnection extends XMPPConnection { * * @param config the connection configuration. */ - public TCPConnection(ConnectionConfiguration config) { + public XMPPTCPConnection(ConnectionConfiguration config) { super(config); } @@ -164,9 +164,9 @@ public class TCPConnection extends XMPPConnection { *

* Manually specifying connection configuration information is suitable for * advanced users of the API. In many cases, using the - * {@link #TCPConnection(String)} constructor is a better approach.

+ * {@link #XMPPTCPConnection(String)} constructor is a better approach.

*

- * Note that TCPConnection constructors do not establish a connection to the server + * Note that XMPPTCPConnection constructors do not establish a connection to the server * and you must call {@link #connect()}.

*

* @@ -177,7 +177,7 @@ public class TCPConnection extends XMPPConnection { * @param config the connection configuration. * @param callbackHandler the CallbackHandler used to prompt for the password to the keystore. */ - public TCPConnection(ConnectionConfiguration config, CallbackHandler callbackHandler) { + public XMPPTCPConnection(ConnectionConfiguration config, CallbackHandler callbackHandler) { super(config); config.setCallbackHandler(callbackHandler); } diff --git a/tcp/src/test/java/org/jivesoftware/smack/RosterOfflineTest.java b/tcp/src/test/java/org/jivesoftware/smack/RosterOfflineTest.java index 5f549b20d..df1c0116f 100644 --- a/tcp/src/test/java/org/jivesoftware/smack/RosterOfflineTest.java +++ b/tcp/src/test/java/org/jivesoftware/smack/RosterOfflineTest.java @@ -34,7 +34,7 @@ public class RosterOfflineTest { @Before public void setup() throws XMPPException, SmackException { - this.connection = new TCPConnection("localhost"); + this.connection = new XMPPTCPConnection("localhost"); assertFalse(connection.isConnected()); roster = connection.getRoster();