XMPPConnection does not expose connect() method

The JavaDoc suggest that the usual way would be to call

// Create a connection to the igniterealtime.org XMPP server. XMPPConnection con = new XMPPTCPConnection("igniterealtime.org");  // Connect to the server con.connect();

However, the connect() method is not in the interface. (also disconnect() and login(…), which are mentioned).

Should be simple to pull them up from AbstractXMPPConnection.

In fact here is the javadoc wrong, or in other words: It’s by design that the XMPPConnection interface does not declare any methods to change the connection state. This is mainly for two reasons:

  1. It doesn’t need to. XMPPConnection (the interface) is used everywhere in Smack, and nowhere, besides the exception of ReconnectionManager, methods to manipulate the connection state are required.

  2. There could be XMPP connection types that are always connected (for whatever reason)

Fixed with https://github.com/igniterealtime/Smack/commit/2853ec39b4f38269d97253f4435cda027 43e8bf8

Ok, got it, thanks.

So to summarize:

Use XMPPConnection when the accessing code should be agnostic of the type of connection

and the implementing classes’ interface for everything dealing with the connection itself.