Class AbstractXMPPConnection
- All Implemented Interfaces:
XMPPConnection
- Direct Known Subclasses:
ModularXmppClientToServerConnection
connect(), login() and
disconnect() (which are deliberately not provided by the XMPPConnection interface).
Note: The default entry point to Smack's documentation is XMPPConnection. If you are getting started
with Smack, then head over to XMPPConnection and the come back here.
Parsing Exceptions
In case a Smack parser (Provider) throws those exceptions are handled over to the ParsingExceptionCallback. A
common cause for a provider throwing is illegal input, for example a non-numeric String where only Integers are
allowed. Smack's default behavior is to take the stanza out of the stream in this case,
i.e., Smack behaves like that stream element was never received.
If the parsing exception is because Smack received illegal input, then please consider informing the authors of the originating entity about that. If it was thrown because of an bug in a Smack parser, then please consider filling a bug with Smack.
Managing the parsing exception callback
You
can change the behavior using setParsingExceptionCallback(ParsingExceptionCallback) to set a custom callback.
Use SmackConfiguration.setDefaultParsingExceptionCallback(ParsingExceptionCallback) to
set the default callback.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classDeprecated.protected static classA wrapper class to associate a stanza filter with a listener.protected static enumNested classes/interfaces inherited from interface org.jivesoftware.smack.XMPPConnection
XMPPConnection.FromMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final AsyncButOrdered<AbstractXMPPConnection> protected booleanFlag that indicates if the user is currently authenticated with the server.protected ZonedDateTimeprotected booleanA synchronization point which is successful if this connection has received the closing stream element from the remote end-point, i.e.protected XMPPInputOutputStreamprotected final ConnectionConfigurationHolds the initial configuration used while creating the connection.protected booleanprotected final intA number to uniquely identify connections that are created.protected final Set<ConnectionListener> A collection of ConnectionListeners which listen for connection closing and reconnection events.protected final Lockprotected final SmackDebuggerThe SmackDebugger allows to log and debug XML traffic.protected StringThe used host to establish the connection toprotected booleanSet totrueif the last features stanza from the server has been parsed.protected XmlEnvironmentprotected UInt16The used port to establish the connection toprotected ReaderThe Reader which is used for the debugger.protected booleanSet totrueif the SASL feature has been received.protected static final SmackReactorprotected final Map<QName, XmlElement> protected StringThe stream ID, see RFC 6120 § 4.7.3protected booleanprotected org.jxmpp.jid.EntityFullJidThe full JID of the authenticated user, as returned by the resource binding response of the server.protected booleanFlag that indicates if the user was authenticated with the server when the connection to the server was closed (abruptly or not).protected WriterThe Writer which is used for the debugger. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractXMPPConnection(ConnectionConfiguration configuration) Create a new XMPPConnection to an XMPP server. -
Method Summary
Modifier and TypeMethodDescriptionaddAsyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter) Registers an asynchronous stanza listener with this connection.voidaddConnectionListener(ConnectionListener connectionListener) Adds a connection listener to this connection that will be notified when the connection closes or fails.voidaddMessageInterceptor(Consumer<MessageBuilder> messageInterceptor, Predicate<Message> messageFilter) Registers a stanza interceptor with this connection.voidaddOneTimeSyncCallback(StanzaListener callback, StanzaFilter packetFilter) Add a callback that is called exactly once and synchronously with the incoming stanza that matches the given stanza filter.voidaddPresenceInterceptor(Consumer<PresenceBuilder> presenceInterceptor, Predicate<Presence> presenceFilter) Registers a stanza interceptor with this connection.final ListenerHandleaddStanzaListener(StanzaListener stanzaListener, StanzaFilter stanzaFilter) Registers a stanza listener with this connection.voidaddStanzaSendingListener(StanzaListener packetListener, StanzaFilter packetFilter) Registers a stanza listener with this connection.protected voidaddStreamFeature(XmlElement feature) addSyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter) Registers a synchronous stanza listener with this connection.protected voidprotected voidHook for subclasses right after successful SASL authentication.protected voidafterSuccessfulLogin(boolean resumed) protected static voidprotected voidasyncGoLimited(Runnable runnable) protected final SASLMechanismauthenticate(String username, String password, org.jxmpp.jid.EntityBareJid authzid, SSLSession sslSession) Authenticate a connection.protected org.jxmpp.jid.parts.ResourcepartbindResourceAndEstablishSession(org.jxmpp.jid.parts.Resourcepart resource) protected final NonzaCallback.Builderprotected voidcallConnectionAuthenticatedListener(boolean resumed) protected voidprotected voidconnect()Establishes a connection to the XMPP server.protected abstract voidAbstract method that concrete subclasses of XMPPConnection need to implement to perform their way of XMPP connection establishment.createStanzaCollector(StanzaFilter packetFilter) Creates a new stanza collector for this connection.createStanzaCollector(StanzaCollector.Configuration configuration) Create a new stanza collector with the given stanza collector configuration.createStanzaCollectorAndSend(StanzaFilter packetFilter, Stanza packet) Creates a new stanza collector for this connection.createStanzaCollectorAndSend(IQ packet) Creates a new stanza collector collecting IQ responses that are replies to the IQrequest.voidCloses the connection by setting presence to unavailable then closing the connection to the XMPP server.voiddisconnect(Presence unavailablePresence) Closes the connection.protected voidfirePacketSendingListeners(TopLevelStreamElement sendTopLevelStreamElement) Process all stanza listeners for sending stanzas.final ZonedDateTimeGet the timestamp when the connection was the first time authenticated, i.e., when the first successful login was performed.Get the connection configuration used by this connection.intGet the connection counter of this XMPPConnection instance.protected Lock<F extends XmlElement>
FgetFeature(QName qname) Get the feature stanza extensions for a given stream feature of the server, ornullif the server doesn't support that feature.Get the currently active FromMode.getHost()Returns the host name of the server where the XMPP server is running.longReturns the timestamp in milliseconds when the last stanza was received.Get the current active parsing exception callback.intgetPort()Returns the port number of the XMPP server for this connection.protected final SmackReactorlongReturns the current value of the reply timeout in milliseconds for request for this XMPPConnection instance.protected final SmackTlsContextfinal StanzaFactoryReturns the stream ID for this connection, which is the value set by the server when opening an XMPP stream.protected AbstractStreamOpengetStreamOpen(org.jxmpp.jid.DomainBareJid to, CharSequence from, String id, String lang) final StringGet the name of the SASL mechanism that was used to authenticate this connection.final org.jxmpp.jid.EntityFullJidgetUser()Returns the full XMPP address of the user that is logged in to the connection ornullif not logged in yet.org.jxmpp.jid.DomainBareJidReturns the XMPP Domain of the service provided by the XMPP server and used for this connection.protected final booleanbooleanhasFeature(QName qname) Return true if the server supports the given stream feature.protected voidInitialize thedebugger.protected voidabstract voidPerforms an unclean disconnect and shutdown of the connection.protected voidInvokeStanzaCollector.processStanza(Stanza)for every StanzaCollector with the given packet.final booleanReturns true if currently authenticated anonymously.final booleanReturns true if currently authenticated by successfully calling the login method.final booleanReturns true if currently connected to the XMPP server.protected final booleanabstract booleanReturns true if the connection to the server has successfully negotiated encryption.abstract booleanReturns true if network traffic is being compressed.voidlogin()Logs in to the server using the strongest SASL mechanism supported by the server.voidlogin(CharSequence username, String password) Same aslogin(CharSequence, String, Resourcepart), but takes the resource from the connection configuration.voidlogin(CharSequence username, String password, org.jxmpp.jid.parts.Resourcepart resource) Login with the given username (authorization identity).protected abstract voidloginInternal(String username, String password, org.jxmpp.jid.parts.Resourcepart resource) protected final voidnotifyConnectionError(Exception exception) Sends out a notification that there was an error with the connection and closes the connection.protected final voidprotected StringonStreamOpen(org.jivesoftware.smack.xml.XmlPullParser parser) Must be called when a XMPP stream open tag is encountered.protected final voidparseAndProcessNonza(org.jivesoftware.smack.xml.XmlPullParser parser) protected voidparseAndProcessStanza(org.jivesoftware.smack.xml.XmlPullParser parser) protected final voidparseFeatures(org.jivesoftware.smack.xml.XmlPullParser parser) protected final voidparseFeaturesAndNotify(org.jivesoftware.smack.xml.XmlPullParser parser) protected voidprocessStanza(Stanza stanza) Processes a stanza after it's been fully parsed by looping through the installed stanza collectors and listeners and letting them examine the stanza to see if they are a match with the filter.registerIQRequestHandler(IQRequestHandler iqRequestHandler) Register an IQ request handler with this connection.booleanremoveAsyncStanzaListener(StanzaListener packetListener) Removes an asynchronous stanza listener for received stanzas from this connection.voidremoveConnectionListener(ConnectionListener connectionListener) Removes a connection listener from this connection.voidremoveMessageInterceptor(Consumer<MessageBuilder> messageInterceptor) Removes a message interceptor.voidremovePresenceInterceptor(Consumer<PresenceBuilder> presenceInterceptor) Removes a presence interceptor.voidremoveStanzaCollector(StanzaCollector collector) Remove a stanza collector of this connection.final booleanremoveStanzaListener(StanzaListener stanzaListener) Removes a stanza listener for received stanzas from this connection.voidremoveStanzaSendingListener(StanzaListener packetListener) Removes a stanza listener for sending stanzas from this connection.booleanremoveSyncStanzaListener(StanzaListener packetListener) Removes a stanza listener for received stanzas from this connection.protected static ScheduledActionsendAndWaitForResponse(Nonza nonza, Class<SN> successNonzaClass, Class<FN> failedNonzaClass) <S extends Stanza>
SmackFuture<S, Exception> sendAsync(S stanza, StanzaFilter replyFilter) Send a stanza asynchronously, waiting for exactly one response stanza using the given reply filter.<S extends Stanza>
SmackFuture<S, Exception> sendAsync(S stanza, StanzaFilter replyFilter, long timeout) Send a stanza asynchronously, waiting for exactly one response stanza using the given reply filter.protected abstract voidsendInternal(TopLevelStreamElement element) <I extends IQ>
IsendIqRequestAndWaitForResponse(IQ request) Send an IQ request and wait for the response.sendIqRequestAsync(IQ request) Send an IQ request asynchronously.sendIqRequestAsync(IQ request, long timeout) Send an IQ request asynchronously.protected abstract voidfinal voidSend a Nonza.final voidsendNonzaNonBlocking(Nonza nonza) final voidsendStanza(Stanza stanza) Sends the specified stanza to the server.final voidsendStanzaNonBlocking(Stanza stanza) protected final voidprotected final voidsetCurrentConnectionExceptionAndNotify(Exception exception) voidsetFromMode(XMPPConnection.FromMode fromMode) Set the FromMode for this connection instance.voidsetMaxAsyncOperations(int maxAsyncOperations) voidInstall a parsing exception callback, which will be invoked once an exception is encountered while parsing a stanza.voidsetReplyTimeout(long timeout) Set the stanza reply timeout in milliseconds.voidsetUnknownIqRequestReplyMode(SmackConfiguration.UnknownIqRequestReplyMode unknownIqRequestReplyMode) Set how Smack behaves when an unknown IQ request has been received.protected voidSets whether the connection has already logged in the server.protected abstract voidshutdown()Shuts the current connection down.protected voidprotected voidprotected voidprotected voidthrowNotConnectedExceptionIfAppropriate(String optionalHint) final StringtoString()booleantrySendStanza(Stanza stanza) Try to send the given stanza.booleantrySendStanza(Stanza stanza, long timeout, TimeUnit unit) Try to send the given stanza.unregisterIQRequestHandler(String element, String namespace, IQ.Type type) Unregister an IQ request handler with this connection.final IQRequestHandlerunregisterIQRequestHandler(IQRequestHandler iqRequestHandler) Convenience method forXMPPConnection.unregisterIQRequestHandler(String, String, org.jivesoftware.smack.packet.IQ.Type).protected voidprotected final booleanprotected final booleanprotected final voidwaitForConditionOrThrowConnectionException(Supplier<Boolean> condition, String waitFor) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jivesoftware.smack.XMPPConnection
getFeature, getLocalAddress, hasFeature
-
Field Details
-
SMACK_REACTOR
-
connectionListeners
A collection of ConnectionListeners which listen for connection closing and reconnection events. -
outgoingStreamXmlEnvironment
-
connectionLock
-
streamFeatures
-
user
protected org.jxmpp.jid.EntityFullJid userThe full JID of the authenticated user, as returned by the resource binding response of the server.It is important that we don't infer the user from the login() arguments and the configurations service name, as, for example, when SASL External is used, the username is not given to login but taken from the 'external' certificate.
-
connected
protected boolean connected -
streamId
The stream ID, see RFC 6120 § 4.7.3 -
debugger
The SmackDebugger allows to log and debug XML traffic. -
reader
The Reader which is used for the debugger. -
writer
The Writer which is used for the debugger. -
tlsHandled
protected boolean tlsHandled -
lastFeaturesReceived
protected boolean lastFeaturesReceivedSet totrueif the last features stanza from the server has been parsed. A XMPP connection handshake can invoke multiple features stanzas, e.g. when TLS is activated a second feature stanza is send by the server. This is set to true once the last feature stanza has been parsed. -
saslFeatureReceived
protected boolean saslFeatureReceivedSet totrueif the SASL feature has been received. -
closingStreamReceived
protected boolean closingStreamReceivedA synchronization point which is successful if this connection has received the closing stream element from the remote end-point, i.e. the server. -
connectionCounterValue
protected final int connectionCounterValueA number to uniquely identify connections that are created. This is distinct from the connection ID, which is a value sent by the server once a connection is made. -
config
Holds the initial configuration used while creating the connection. -
compressionHandler
-
ASYNC_BUT_ORDERED
-
host
The used host to establish the connection to -
port
The used port to establish the connection to -
authenticated
protected boolean authenticatedFlag that indicates if the user is currently authenticated with the server. -
authenticatedConnectionInitiallyEstablishedTimestamp
-
wasAuthenticated
protected boolean wasAuthenticatedFlag that indicates if the user was authenticated with the server when the connection to the server was closed (abruptly or not).
-
-
Constructor Details
-
AbstractXMPPConnection
Create a new XMPPConnection to an XMPP server.- Parameters:
configuration- The configuration which is used to establish the connection.
-
-
Method Details
-
getConfiguration
Get the connection configuration used by this connection.- Returns:
- the connection configuration.
-
getXMPPServiceDomain
public org.jxmpp.jid.DomainBareJid getXMPPServiceDomain()Description copied from interface:XMPPConnectionReturns the XMPP Domain of the service provided by the XMPP server and used for this connection. After authenticating with the server the returned value may be different.- Specified by:
getXMPPServiceDomainin interfaceXMPPConnection- Returns:
- the XMPP domain of this XMPP session.
-
getHost
Description copied from interface:XMPPConnectionReturns the host name of the server where the XMPP server is running. This would be the IP address of the server or a name that may be resolved by a DNS server.- Specified by:
getHostin interfaceXMPPConnection- Returns:
- the host name of the server where the XMPP server is running or null if not yet connected.
-
getPort
public int getPort()Description copied from interface:XMPPConnectionReturns the port number of the XMPP server for this connection. The default port for normal connections is 5222.- Specified by:
getPortin interfaceXMPPConnection- Returns:
- the port number of the XMPP server or 0 if not yet connected.
-
isSecureConnection
public abstract boolean isSecureConnection()Description copied from interface:XMPPConnectionReturns true if the connection to the server has successfully negotiated encryption.- Specified by:
isSecureConnectionin interfaceXMPPConnection- Returns:
- true if a secure connection to the server.
-
sendInternal
protected abstract void sendInternal(TopLevelStreamElement element) throws SmackException.NotConnectedException, InterruptedException -
sendNonBlockingInternal
protected abstract void sendNonBlockingInternal(TopLevelStreamElement element) throws SmackException.NotConnectedException, SmackException.OutgoingQueueFullException -
trySendStanza
Description copied from interface:XMPPConnectionTry to send the given stanza. Returnstrueif the stanza was successfully put into the outgoing stanza queue, otherwise, iffalseis returned, the stanza could not be scheduled for sending (for example because the outgoing element queue is full). Note that this means that the stanza possibly was not put onto the wire, even iftrueis returned, it just has been successfully scheduled for sending.Note: Implementations are not required to provide that functionality. In that case this method is mapped to
XMPPConnection.sendStanza(Stanza)and will possibly block until the stanza could be scheduled for sending.- Specified by:
trySendStanzain interfaceXMPPConnection- Parameters:
stanza- the stanza to send.- Returns:
trueif the stanza was successfully scheduled to be sent,falseotherwise.- Throws:
SmackException.NotConnectedException- if the connection is not connected.
-
trySendStanza
public boolean trySendStanza(Stanza stanza, long timeout, TimeUnit unit) throws SmackException.NotConnectedException, InterruptedException Description copied from interface:XMPPConnectionTry to send the given stanza. Returnstrueif the stanza was successfully put into the outgoing stanza queue within the given timeout period, otherwise, iffalseis returned, the stanza could not be scheduled for sending (for example because the outgoing element queue is full). Note that this means that the stanza possibly was not put onto the wire, even iftrueis returned, it just has been successfully scheduled for sending.Note: Implementations are not required to provide that functionality. In that case this method is mapped to
XMPPConnection.sendStanza(Stanza)and will possibly block until the stanza could be scheduled for sending.- Specified by:
trySendStanzain interfaceXMPPConnection- Parameters:
stanza- the stanza to send.timeout- how long to wait before giving up, in units ofunit.unit- aTimeUnitdetermining how to interpret thetimeoutparameter.- Returns:
trueif the stanza was successfully scheduled to be sent,falseotherwise.- Throws:
SmackException.NotConnectedException- if the connection is not connected.InterruptedException- if the calling thread was interrupted.
-
sendNonza
public final void sendNonza(Nonza nonza) throws SmackException.NotConnectedException, InterruptedException Description copied from interface:XMPPConnectionSend a Nonza.This method is not meant for end-user usage! It allows sending plain stream elements, which should not be done by a user manually. Doing so may result in a unstable or unusable connection. Certain Smack APIs use this method to send plain stream elements.
- Specified by:
sendNonzain interfaceXMPPConnection- Parameters:
nonza- the Nonza to send.- Throws:
SmackException.NotConnectedException- if the XMPP connection is not connected.InterruptedException- if the calling thread was interrupted.
-
sendNonzaNonBlocking
public final void sendNonzaNonBlocking(Nonza nonza) throws SmackException.NotConnectedException, SmackException.OutgoingQueueFullException - Specified by:
sendNonzaNonBlockingin interfaceXMPPConnection- Throws:
SmackException.NotConnectedExceptionSmackException.OutgoingQueueFullException
-
isUsingCompression
public abstract boolean isUsingCompression()Description copied from interface:XMPPConnectionReturns true if network traffic is being compressed. When using stream compression network traffic can be reduced up to 90%. Therefore, stream compression is ideal when using a slow speed network connection. However, the server will need to use more CPU time in order to un/compress network data so under high load the server performance might be affected.- Specified by:
isUsingCompressionin interfaceXMPPConnection- Returns:
- true if network traffic is being compressed.
-
initState
protected void initState() -
connect
public AbstractXMPPConnection connect() throws SmackException, IOException, XMPPException, InterruptedExceptionEstablishes a connection to the XMPP server. It basically creates and maintains a connection to the server.Listeners will be preserved from a previous connection.
- Returns:
- a reference to this object, to chain
connect()withlogin(). - Throws:
XMPPException- if an error occurs on the XMPP protocol level.SmackException- if an error occurs somewhere else besides XMPP protocol level.IOException- if an I/O error occurred.InterruptedException- if the calling thread was interrupted.
-
connectInternal
protected abstract void connectInternal() throws SmackException, IOException, XMPPException, InterruptedExceptionAbstract method that concrete subclasses of XMPPConnection need to implement to perform their way of XMPP connection establishment. Implementations are required to perform an automatic login if the previous connection state was logged (authenticated).- Throws:
SmackException- if Smack detected an exceptional situation.IOException- if an I/O error occurred.XMPPException- if an XMPP protocol error was received.InterruptedException- if the calling thread was interrupted.
-
login
Logs in to the server using the strongest SASL mechanism supported by the server. If more than the connection's default stanza timeout elapses in each step of the authentication process without a response from the server, aSmackException.NoResponseExceptionwill be thrown.Before logging in (i.e. authenticate) to the server the connection must be connected by calling
connect().It is possible to log in without sending an initial available presence by using
ConnectionConfiguration.Builder.setSendPresence(boolean). Finally, if you want to not pass a password and instead use a more advanced mechanism while using SASL then you may be interested in usingConnectionConfiguration.Builder.setCallbackHandler(javax.security.auth.callback.CallbackHandler). For more advanced login settings seeConnectionConfiguration.- Throws:
XMPPException- if an error occurs on the XMPP protocol level.SmackException- if an error occurs somewhere else besides XMPP protocol level.IOException- if an I/O error occurs during login.InterruptedException- if the calling thread was interrupted.
-
login
public void login(CharSequence username, String password) throws XMPPException, SmackException, IOException, InterruptedException Same aslogin(CharSequence, String, Resourcepart), but takes the resource from the connection configuration.- Parameters:
username- TODO javadoc me pleasepassword- TODO javadoc me please- Throws:
XMPPException- if an XMPP protocol error was received.SmackException- if Smack detected an exceptional situation.IOException- if an I/O error occurred.InterruptedException- if the calling thread was interrupted.- See Also:
-
login
public void login(CharSequence username, String password, org.jxmpp.jid.parts.Resourcepart resource) throws XMPPException, SmackException, IOException, InterruptedException Login with the given username (authorization identity). You may omit the password if a callback handler is used. If resource is null, then the server will generate one.- Parameters:
username- TODO javadoc me pleasepassword- TODO javadoc me pleaseresource- TODO javadoc me please- Throws:
XMPPException- if an XMPP protocol error was received.SmackException- if Smack detected an exceptional situation.IOException- if an I/O error occurred.InterruptedException- if the calling thread was interrupted.- See Also:
-
loginInternal
protected abstract void loginInternal(String username, String password, org.jxmpp.jid.parts.Resourcepart resource) throws XMPPException, SmackException, IOException, InterruptedException -
isConnected
public final boolean isConnected()Description copied from interface:XMPPConnectionReturns true if currently connected to the XMPP server.- Specified by:
isConnectedin interfaceXMPPConnection- Returns:
- true if connected.
-
isAuthenticated
public final boolean isAuthenticated()Description copied from interface:XMPPConnectionReturns true if currently authenticated by successfully calling the login method.- Specified by:
isAuthenticatedin interfaceXMPPConnection- Returns:
- true if authenticated.
-
getUser
public final org.jxmpp.jid.EntityFullJid getUser()Description copied from interface:XMPPConnectionReturns the full XMPP address of the user that is logged in to the connection ornullif not logged in yet. An XMPP address is in the form username@server/resource.- Specified by:
getUserin interfaceXMPPConnection- Returns:
- the full XMPP address of the user logged in.
-
getStreamId
Description copied from interface:XMPPConnectionReturns the stream ID for this connection, which is the value set by the server when opening an XMPP stream. This value will benullif not connected to the server.- Specified by:
getStreamIdin interfaceXMPPConnection- Returns:
- the ID of this connection returned from the XMPP server or
nullif not connected to the server. - See Also:
-
hasCurrentConnectionException
protected final boolean hasCurrentConnectionException() -
setCurrentConnectionExceptionAndNotify
-
notifyWaitingThreads
protected final void notifyWaitingThreads() -
waitFor
- Throws:
InterruptedException
-
waitForConditionOrThrowConnectionException
protected final void waitForConditionOrThrowConnectionException(Supplier<Boolean> condition, String waitFor) throws InterruptedException, SmackException.SmackWrappedException, SmackException.NoResponseException -
bindResourceAndEstablishSession
protected org.jxmpp.jid.parts.Resourcepart bindResourceAndEstablishSession(org.jxmpp.jid.parts.Resourcepart resource) throws SmackException, InterruptedException, XMPPException -
afterSuccessfulLogin
protected void afterSuccessfulLogin(boolean resumed) throws SmackException.NotConnectedException, InterruptedException -
isAnonymous
public final boolean isAnonymous()Description copied from interface:XMPPConnectionReturns true if currently authenticated anonymously.- Specified by:
isAnonymousin interfaceXMPPConnection- Returns:
- true if authenticated anonymously.
-
getUsedSaslMechansism
Get the name of the SASL mechanism that was used to authenticate this connection. This returns the name of mechanism which was used the last time this connection was authenticated, and will returnnullif this connection was not authenticated before.- Returns:
- the name of the used SASL mechanism.
- Since:
- 4.2
-
getConnectionLock
-
throwNotConnectedExceptionIfAppropriate
protected void throwNotConnectedExceptionIfAppropriate() throws SmackException.NotConnectedException -
throwNotConnectedExceptionIfAppropriate
protected void throwNotConnectedExceptionIfAppropriate(String optionalHint) throws SmackException.NotConnectedException -
throwAlreadyConnectedExceptionIfAppropriate
protected void throwAlreadyConnectedExceptionIfAppropriate() throws SmackException.AlreadyConnectedException -
throwAlreadyLoggedInExceptionIfAppropriate
protected void throwAlreadyLoggedInExceptionIfAppropriate() throws SmackException.AlreadyLoggedInException -
getStanzaFactory
- Specified by:
getStanzaFactoryin interfaceXMPPConnection
-
sendStanza
public final void sendStanza(Stanza stanza) throws SmackException.NotConnectedException, InterruptedException Description copied from interface:XMPPConnectionSends the specified stanza to the server.- Specified by:
sendStanzain interfaceXMPPConnection- Parameters:
stanza- the stanza to send.- Throws:
SmackException.NotConnectedException- if the connection is not connected.InterruptedException- if the calling thread was interrupted.
-
sendStanzaNonBlocking
public final void sendStanzaNonBlocking(Stanza stanza) throws SmackException.NotConnectedException, SmackException.OutgoingQueueFullException - Specified by:
sendStanzaNonBlockingin interfaceXMPPConnection- Throws:
SmackException.NotConnectedExceptionSmackException.OutgoingQueueFullException
-
authenticate
protected final SASLMechanism authenticate(String username, String password, org.jxmpp.jid.EntityBareJid authzid, SSLSession sslSession) throws XMPPException.XMPPErrorException, SASLErrorException, SmackException.SmackSaslException, SmackException.NotConnectedException, SmackException.NoResponseException, IOException, InterruptedException, SmackException.SmackWrappedException Authenticate a connection.- Parameters:
username- the username that is authenticating with the server.password- the password to send to the server.authzid- the authorization identifier (typically null).sslSession- the optional SSL/TLS session (if one was established)- Returns:
- the used SASLMechanism.
- Throws:
XMPPException.XMPPErrorException- if there was an XMPP error returned.SASLErrorException- if a SASL protocol error was returned.IOException- if an I/O error occurred.InterruptedException- if the calling thread was interrupted.SmackException.SmackSaslException- if a SASL specific error occurred.SmackException.NotConnectedException- if the XMPP connection is not connected.SmackException.NoResponseException- if there was no response from the remote entity.SmackException.SmackWrappedException- in case of an exception.- See Also:
-
afterSaslAuthenticationSuccess
protected void afterSaslAuthenticationSuccess() throws SmackException.NotConnectedException, InterruptedException, SmackException.SmackWrappedExceptionHook for subclasses right after successful SASL authentication. RFC 6120 § 6.4.6. specifies a that the initiating entity, needs to initiate a new stream in this case. But some transports, like BOSH, requires a special handling.Note that we can not reset XMPPTCPConnection's parser here, because this method is invoked by the thread calling
login(), but the parser reset has to be done within the reader thread.- Throws:
SmackException.NotConnectedException- if the XMPP connection is not connected.InterruptedException- if the calling thread was interrupted.SmackException.SmackWrappedException- in case of an exception.
-
isSaslAuthenticated
protected final boolean isSaslAuthenticated() -
disconnect
public void disconnect()Closes the connection by setting presence to unavailable then closing the connection to the XMPP server. The XMPPConnection can still be used for connecting to the server again. -
disconnect
Closes the connection. A custom unavailable presence is sent to the server, followed by closing the stream. The XMPPConnection can still be used for connecting to the server again. A custom unavailable presence is useful for communicating offline presence information such as "On vacation". Typically, just the status text of the presence stanza is set with online information, but most XMPP servers will deliver the full presence stanza with whatever data is set.- Parameters:
unavailablePresence- the optional presence stanza to send during shutdown.- Throws:
SmackException.NotConnectedException- if the XMPP connection is not connected.
-
notifyConnectionError
Sends out a notification that there was an error with the connection and closes the connection.- Parameters:
exception- the exception that causes the connection close event.
-
instantShutdown
public abstract void instantShutdown()Performs an unclean disconnect and shutdown of the connection. Does not send a closing stream stanza. -
shutdown
protected abstract void shutdown()Shuts the current connection down. -
waitForClosingStreamTagFromServer
protected final boolean waitForClosingStreamTagFromServer() -
addConnectionListener
Description copied from interface:XMPPConnectionAdds a connection listener to this connection that will be notified when the connection closes or fails.- Specified by:
addConnectionListenerin interfaceXMPPConnection- Parameters:
connectionListener- a connection listener.
-
removeConnectionListener
Description copied from interface:XMPPConnectionRemoves a connection listener from this connection.- Specified by:
removeConnectionListenerin interfaceXMPPConnection- Parameters:
connectionListener- a connection listener.
-
sendIqRequestAndWaitForResponse
public <I extends IQ> I sendIqRequestAndWaitForResponse(IQ request) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException Description copied from interface:XMPPConnectionSend an IQ request and wait for the response.- Specified by:
sendIqRequestAndWaitForResponsein interfaceXMPPConnection- Type Parameters:
I- the type of the expected result IQ.- Parameters:
request- the IQ request- Returns:
- an IQ with type 'result'
- Throws:
SmackException.NoResponseException- if there was no response from the remote entity.XMPPException.XMPPErrorException- if there was an XMPP error returned.SmackException.NotConnectedException- if the XMPP connection is not connected.InterruptedException- if the calling thread was interrupted.
-
createStanzaCollectorAndSend
public StanzaCollector createStanzaCollectorAndSend(IQ packet) throws SmackException.NotConnectedException, InterruptedException Description copied from interface:XMPPConnectionCreates a new stanza collector collecting IQ responses that are replies to the IQrequest. Does also send therequestIQ. The stanza filter for the collector is anIQReplyFilter, guaranteeing that stanza id and JID in the 'from' address have expected values.- Specified by:
createStanzaCollectorAndSendin interfaceXMPPConnection- Parameters:
packet- the IQ request to filter responses from- Returns:
- a new stanza collector.
- Throws:
SmackException.NotConnectedException- if the XMPP connection is not connected.InterruptedException- if the calling thread was interrupted.
-
createStanzaCollectorAndSend
public StanzaCollector createStanzaCollectorAndSend(StanzaFilter packetFilter, Stanza packet) throws SmackException.NotConnectedException, InterruptedException Description copied from interface:XMPPConnectionCreates a new stanza collector for this connection. A stanza filter determines which stanzas will be accumulated by the collector. A StanzaCollector is more suitable to use than aStanzaListenerwhen you need to wait for a specific result.- Specified by:
createStanzaCollectorAndSendin interfaceXMPPConnection- Parameters:
packetFilter- the stanza filter to use.packet- the stanza to send right after the collector got created- Returns:
- a new stanza collector.
- Throws:
SmackException.NotConnectedException- if the XMPP connection is not connected.InterruptedException- if the calling thread was interrupted.
-
createStanzaCollector
Description copied from interface:XMPPConnectionCreates a new stanza collector for this connection. A stanza filter determines which stanzas will be accumulated by the collector. A StanzaCollector is more suitable to use than aStanzaListenerwhen you need to wait for a specific result.Note: If you send a Stanza right after using this method, then consider using
XMPPConnection.createStanzaCollectorAndSend(StanzaFilter, Stanza)instead. Otherwise make sure cancel the StanzaCollector in every case, e.g. even if an exception is thrown, or otherwise you may leak the StanzaCollector.- Specified by:
createStanzaCollectorin interfaceXMPPConnection- Parameters:
packetFilter- the stanza filter to use.- Returns:
- a new stanza collector.
-
createStanzaCollector
Description copied from interface:XMPPConnectionCreate a new stanza collector with the given stanza collector configuration.Please make sure to cancel the collector when it is no longer required. See also
XMPPConnection.createStanzaCollector(StanzaFilter).- Specified by:
createStanzaCollectorin interfaceXMPPConnection- Parameters:
configuration- the stanza collector configuration.- Returns:
- a new stanza collector.
-
removeStanzaCollector
Description copied from interface:XMPPConnectionRemove a stanza collector of this connection.- Specified by:
removeStanzaCollectorin interfaceXMPPConnection- Parameters:
collector- a stanza collectors which was created for this connection.
-
addStanzaListener
public final ListenerHandle addStanzaListener(StanzaListener stanzaListener, StanzaFilter stanzaFilter) Description copied from interface:XMPPConnectionRegisters a stanza listener with this connection. The listener will be invoked when a (matching) incoming stanza is received. The stanza filter determines which stanzas will be delivered to the listener. It is guaranteed that the same listener will not be invoked concurrently and the order of invocation will reflect the order in which the stanzas have been received. If the same stanza listener is added again with a different filter, only the new filter will be used.- Specified by:
addStanzaListenerin interfaceXMPPConnection- Parameters:
stanzaListener- the stanza listener to notify of new received stanzas.stanzaFilter- the stanza filter to use.- Returns:
- a handle which can be used in try-with-resources statements.
-
removeStanzaListener
Description copied from interface:XMPPConnectionRemoves a stanza listener for received stanzas from this connection.- Specified by:
removeStanzaListenerin interfaceXMPPConnection- Parameters:
stanzaListener- the stanza listener to remove.- Returns:
- true if the stanza listener was removed.
-
addSyncStanzaListener
public ListenerHandle addSyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter) Description copied from interface:XMPPConnectionRegisters a synchronous stanza listener with this connection. A stanza listener will be invoked only when an incoming stanza is received. A stanza filter determines which stanzas will be delivered to the listener. If the same stanza listener is added again with a different filter, only the new filter will be used.Important: This stanza listeners will be called in the same single thread that processes all incoming stanzas. Only use this kind of stanza filter if it does not perform any XMPP activity that waits for a response. Consider using
XMPPConnection.addAsyncStanzaListener(StanzaListener, StanzaFilter)when possible, i.e. when the invocation order doesn't have to be the same as the order of the arriving stanzas. If the order of the arriving stanzas, consider using aStanzaCollectorwhen possible.- Specified by:
addSyncStanzaListenerin interfaceXMPPConnection- Parameters:
packetListener- the stanza listener to notify of new received stanzas.packetFilter- the stanza filter to use.- Returns:
- a handle which can be used in try-with-resources statements.
-
removeSyncStanzaListener
Description copied from interface:XMPPConnectionRemoves a stanza listener for received stanzas from this connection.- Specified by:
removeSyncStanzaListenerin interfaceXMPPConnection- Parameters:
packetListener- the stanza listener to remove.- Returns:
- true if the stanza listener was removed
-
addAsyncStanzaListener
public ListenerHandle addAsyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter) Description copied from interface:XMPPConnectionRegisters an asynchronous stanza listener with this connection. A stanza listener will be invoked only when an incoming stanza is received. A stanza filter determines which stanzas will be delivered to the listener. If the same stanza listener is added again with a different filter, only the new filter will be used.Unlike
XMPPConnection.addAsyncStanzaListener(StanzaListener, StanzaFilter)stanza listeners added with this method will be invoked asynchronously in their own thread. Use this method if the order of the stanza listeners must not depend on the order how the stanzas where received.- Specified by:
addAsyncStanzaListenerin interfaceXMPPConnection- Parameters:
packetListener- the stanza listener to notify of new received stanzas.packetFilter- the stanza filter to use.- Returns:
- a handle which can be used in try-with-resources statements.
-
removeAsyncStanzaListener
Description copied from interface:XMPPConnectionRemoves an asynchronous stanza listener for received stanzas from this connection.- Specified by:
removeAsyncStanzaListenerin interfaceXMPPConnection- Parameters:
packetListener- the stanza listener to remove.- Returns:
- true if the stanza listener was removed
-
addStanzaSendingListener
Description copied from interface:XMPPConnectionRegisters a stanza listener with this connection. The listener will be notified of every stanza that this connection sends. A stanza filter determines which stanzas will be delivered to the listener. Note that the thread that writes stanzas will be used to invoke the listeners. Therefore, each stanza listener should complete all operations quickly or use a different thread for processing.- Specified by:
addStanzaSendingListenerin interfaceXMPPConnection- Parameters:
packetListener- the stanza listener to notify of sent stanzas.packetFilter- the stanza filter to use.
-
removeStanzaSendingListener
Description copied from interface:XMPPConnectionRemoves a stanza listener for sending stanzas from this connection.- Specified by:
removeStanzaSendingListenerin interfaceXMPPConnection- Parameters:
packetListener- the stanza listener to remove.
-
firePacketSendingListeners
Process all stanza listeners for sending stanzas.Compared to
firePacketInterceptors(Stanza), the listeners will be invoked in a new thread.- Parameters:
sendTopLevelStreamElement- the top level stream element which just got send.
-
addMessageInterceptor
public void addMessageInterceptor(Consumer<MessageBuilder> messageInterceptor, Predicate<Message> messageFilter) Description copied from interface:XMPPConnectionRegisters a stanza interceptor with this connection. The interceptor will be invoked every time a stanza is about to be sent by this connection. Interceptors may modify the stanza to be sent. A stanza filter determines which stanzas will be delivered to the interceptor.NOTE: For a similar functionality on incoming stanzas, see
XMPPConnection.addAsyncStanzaListener(StanzaListener, StanzaFilter).- Specified by:
addMessageInterceptorin interfaceXMPPConnection- Parameters:
messageInterceptor- the stanza interceptor to notify of stanzas about to be sent.messageFilter- the stanza filter to use.
-
removeMessageInterceptor
Description copied from interface:XMPPConnectionRemoves a message interceptor.- Specified by:
removeMessageInterceptorin interfaceXMPPConnection- Parameters:
messageInterceptor- the message interceptor to remove.
-
addPresenceInterceptor
public void addPresenceInterceptor(Consumer<PresenceBuilder> presenceInterceptor, Predicate<Presence> presenceFilter) Description copied from interface:XMPPConnectionRegisters a stanza interceptor with this connection. The interceptor will be invoked every time a stanza is about to be sent by this connection. Interceptors may modify the stanza to be sent. A stanza filter determines which stanzas will be delivered to the interceptor.NOTE: For a similar functionality on incoming stanzas, see
XMPPConnection.addAsyncStanzaListener(StanzaListener, StanzaFilter).- Specified by:
addPresenceInterceptorin interfaceXMPPConnection- Parameters:
presenceInterceptor- the stanza interceptor to notify of stanzas about to be sent.presenceFilter- the stanza filter to use.
-
removePresenceInterceptor
Description copied from interface:XMPPConnectionRemoves a presence interceptor.- Specified by:
removePresenceInterceptorin interfaceXMPPConnection- Parameters:
presenceInterceptor- the stanza interceptor to remove.
-
initDebugger
protected void initDebugger()Initialize thedebugger. You can specify a customizedSmackDebuggerby setup the system propertysmack.debuggerClassto the implementation.- Throws:
IllegalStateException- if the reader or writer isn't yet initialized.IllegalArgumentException- if the SmackDebugger can't be loaded.
-
getReplyTimeout
public long getReplyTimeout()Description copied from interface:XMPPConnectionReturns the current value of the reply timeout in milliseconds for request for this XMPPConnection instance.- Specified by:
getReplyTimeoutin interfaceXMPPConnection- Returns:
- the reply timeout in milliseconds
-
setReplyTimeout
public void setReplyTimeout(long timeout) Description copied from interface:XMPPConnectionSet the stanza reply timeout in milliseconds. In most cases, Smack will throw aSmackException.NoResponseExceptionif no reply to a request was received within the timeout period.- Specified by:
setReplyTimeoutin interfaceXMPPConnection- Parameters:
timeout- for a reply in milliseconds
-
setUnknownIqRequestReplyMode
public void setUnknownIqRequestReplyMode(SmackConfiguration.UnknownIqRequestReplyMode unknownIqRequestReplyMode) Set how Smack behaves when an unknown IQ request has been received.- Parameters:
unknownIqRequestReplyMode- reply mode.
-
buildNonzaCallback
-
sendAndWaitForResponse
protected <SN extends Nonza,FN extends Nonza> SN sendAndWaitForResponse(Nonza nonza, Class<SN> successNonzaClass, Class<FN> failedNonzaClass) throws SmackException.NoResponseException, SmackException.NotConnectedException, InterruptedException, XMPPException.FailedNonzaException -
parseAndProcessNonza
protected final void parseAndProcessNonza(org.jivesoftware.smack.xml.XmlPullParser parser) throws IOException, org.jivesoftware.smack.xml.XmlPullParserException, SmackParsingException - Throws:
IOExceptionorg.jivesoftware.smack.xml.XmlPullParserExceptionSmackParsingException
-
parseAndProcessStanza
protected void parseAndProcessStanza(org.jivesoftware.smack.xml.XmlPullParser parser) throws InterruptedException - Throws:
InterruptedException
-
processStanza
Processes a stanza after it's been fully parsed by looping through the installed stanza collectors and listeners and letting them examine the stanza to see if they are a match with the filter.- Parameters:
stanza- the stanza to process.- Throws:
InterruptedException- if the calling thread was interrupted.
-
invokeStanzaCollectorsAndNotifyRecvListeners
InvokeStanzaCollector.processStanza(Stanza)for every StanzaCollector with the given packet. Also notify the receive listeners with a matching stanza filter about the packet.This method will be invoked by the connections incoming processing thread which may be shared across multiple connections and thus it is important that no user code, e.g. in form of a callback, is invoked by this method. For the same reason, this method must not block for an extended period of time.
- Parameters:
packet- the stanza to notify the StanzaCollectors and receive listeners about.
-
setWasAuthenticated
protected void setWasAuthenticated()Sets whether the connection has already logged in the server. This method assures that thewasAuthenticatedflag is never reset once it has ever been set. -
callConnectionConnectingListener
protected void callConnectionConnectingListener() -
callConnectionConnectedListener
protected void callConnectionConnectedListener() -
callConnectionAuthenticatedListener
protected void callConnectionAuthenticatedListener(boolean resumed) -
getConnectionCounter
public int getConnectionCounter()Description copied from interface:XMPPConnectionGet the connection counter of this XMPPConnection instance. Those can be used as ID to identify the connection, but beware that the ID may not be unique if you create more then2*Integer.MAX_VALUEinstances as the counter could wrap.- Specified by:
getConnectionCounterin interfaceXMPPConnection- Returns:
- the connection counter of this XMPPConnection
-
setFromMode
Description copied from interface:XMPPConnectionSet the FromMode for this connection instance. Defines how the 'from' attribute of outgoing stanzas should be populated by Smack.- Specified by:
setFromModein interfaceXMPPConnection- Parameters:
fromMode- TODO javadoc me please
-
getFromMode
Description copied from interface:XMPPConnectionGet the currently active FromMode.- Specified by:
getFromModein interfaceXMPPConnection- Returns:
- the currently active
XMPPConnection.FromMode
-
parseFeatures
protected final void parseFeatures(org.jivesoftware.smack.xml.XmlPullParser parser) throws org.jivesoftware.smack.xml.XmlPullParserException, IOException, SmackParsingException - Throws:
org.jivesoftware.smack.xml.XmlPullParserExceptionIOExceptionSmackParsingException
-
parseFeaturesAndNotify
protected final void parseFeaturesAndNotify(org.jivesoftware.smack.xml.XmlPullParser parser) throws Exception - Throws:
Exception
-
afterFeaturesReceived
protected void afterFeaturesReceived() throws SmackException.SecurityRequiredException, SmackException.NotConnectedException, InterruptedException -
getFeature
Description copied from interface:XMPPConnectionGet the feature stanza extensions for a given stream feature of the server, ornullif the server doesn't support that feature.- Specified by:
getFeaturein interfaceXMPPConnection- Type Parameters:
F-ExtensionElementtype of the feature.- Parameters:
qname- the qualified name of the XML element of feature.- Returns:
- a stanza extensions of the feature or
null
-
hasFeature
Description copied from interface:XMPPConnectionReturn true if the server supports the given stream feature.- Specified by:
hasFeaturein interfaceXMPPConnection- Parameters:
qname- the qualified name of the XML element of feature.- Returns:
- true if the server supports the stream feature.
-
addStreamFeature
-
sendIqRequestAsync
Description copied from interface:XMPPConnectionSend an IQ request asynchronously. The connection's default reply timeout will be used.- Specified by:
sendIqRequestAsyncin interfaceXMPPConnection- Parameters:
request- the IQ request to send.- Returns:
- a SmackFuture for the response.
-
sendIqRequestAsync
Description copied from interface:XMPPConnectionSend an IQ request asynchronously.- Specified by:
sendIqRequestAsyncin interfaceXMPPConnection- Parameters:
request- the IQ request to send.timeout- the reply timeout in milliseconds.- Returns:
- a SmackFuture for the response.
-
sendAsync
Description copied from interface:XMPPConnectionSend a stanza asynchronously, waiting for exactly one response stanza using the given reply filter. The connection's default reply timeout will be used.- Specified by:
sendAsyncin interfaceXMPPConnection- Type Parameters:
S- the type of the stanza to send.- Parameters:
stanza- the stanza to send.replyFilter- the filter used for the response stanza.- Returns:
- a SmackFuture for the response.
-
sendAsync
public <S extends Stanza> SmackFuture<S,Exception> sendAsync(S stanza, StanzaFilter replyFilter, long timeout) Description copied from interface:XMPPConnectionSend a stanza asynchronously, waiting for exactly one response stanza using the given reply filter.- Specified by:
sendAsyncin interfaceXMPPConnection- Type Parameters:
S- the type of the stanza to send.- Parameters:
stanza- the stanza to send.replyFilter- the filter used for the response stanza.timeout- the reply timeout in milliseconds.- Returns:
- a SmackFuture for the response.
-
addOneTimeSyncCallback
Description copied from interface:XMPPConnectionAdd a callback that is called exactly once and synchronously with the incoming stanza that matches the given stanza filter.- Specified by:
addOneTimeSyncCallbackin interfaceXMPPConnection- Parameters:
callback- the callback invoked once the stanza filter matches a stanza.packetFilter- the filter to match stanzas or null to match all.
-
registerIQRequestHandler
Description copied from interface:XMPPConnectionRegister an IQ request handler with this connection.IQ request handler process incoming IQ requests, i.e. incoming IQ stanzas of type 'get' or 'set', and return a result.
- Specified by:
registerIQRequestHandlerin interfaceXMPPConnection- Parameters:
iqRequestHandler- the IQ request handler to register.- Returns:
- the previously registered IQ request handler or null.
-
unregisterIQRequestHandler
Description copied from interface:XMPPConnectionConvenience method forXMPPConnection.unregisterIQRequestHandler(String, String, org.jivesoftware.smack.packet.IQ.Type).- Specified by:
unregisterIQRequestHandlerin interfaceXMPPConnection- Parameters:
iqRequestHandler- TODO javadoc me please- Returns:
- the previously registered IQ request handler or null.
-
unregisterIQRequestHandler
Description copied from interface:XMPPConnectionUnregister an IQ request handler with this connection.- Specified by:
unregisterIQRequestHandlerin interfaceXMPPConnection- Parameters:
element- the IQ element the IQ request handler is responsible for.namespace- the IQ namespace the IQ request handler is responsible for.type- the IQ type the IQ request handler is responsible for.- Returns:
- the previously registered IQ request handler or null.
-
getLastStanzaReceived
public long getLastStanzaReceived()Description copied from interface:XMPPConnectionReturns the timestamp in milliseconds when the last stanza was received.- Specified by:
getLastStanzaReceivedin interfaceXMPPConnection- Returns:
- the timestamp in milliseconds
-
getAuthenticatedConnectionInitiallyEstablishedTimestamp
Get the timestamp when the connection was the first time authenticated, i.e., when the first successful login was performed. Note that this value is not reset on disconnect, so it represents the timestamp from the last authenticated connection. The value is also not reset on stream resumption.- Returns:
- the timestamp or
null. - Since:
- 4.3.3
-
setParsingExceptionCallback
Install a parsing exception callback, which will be invoked once an exception is encountered while parsing a stanza.- Parameters:
callback- the callback to install
-
getParsingExceptionCallback
Get the current active parsing exception callback.- Returns:
- the active exception callback or null if there is none
-
toString
-
asyncGoLimited
-
setMaxAsyncOperations
public void setMaxAsyncOperations(int maxAsyncOperations) -
asyncGo
-
getReactor
-
schedule
-
onStreamOpen
Must be called when a XMPP stream open tag is encountered. Sets values like the stream ID and the incoming stream XML environment.This method also returns a matching stream close tag. For example if the stream open is
<stream …>, then</stream>is returned. But if it is<stream:stream>, then</stream:stream>is returned. Or if it is<foo:stream>, then</foo:stream>is returned.- Parameters:
parser- an XML parser that is positioned at the start of the stream open.- Returns:
- a String representing the corresponding stream end tag.
-
sendStreamOpen
protected final void sendStreamOpen() throws SmackException.NotConnectedException, InterruptedException -
getStreamOpen
protected AbstractStreamOpen getStreamOpen(org.jxmpp.jid.DomainBareJid to, CharSequence from, String id, String lang) -
updateOutgoingStreamXmlEnvironmentOnStreamOpen
-
getSmackTlsContext
-