public abstract class AbstractXMPPConnection extends java.lang.Object implements XMPPConnection
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractXMPPConnection.InterceptorWrapper
A wrapper class to associate a packet filter with an interceptor.
|
protected static class |
AbstractXMPPConnection.ListenerWrapper
A wrapper class to associate a packet filter with a listener.
|
XMPPConnection.FromMode| Modifier and Type | Field and Description |
|---|---|
protected boolean |
authenticated
Flag that indicates if the user is currently authenticated with the server.
|
protected XMPPInputOutputStream |
compressionHandler |
protected ConnectionConfiguration |
config
Holds the initial configuration used while creating the connection.
|
protected boolean |
connected |
protected int |
connectionCounterValue
A number to uniquely identify connections that are created.
|
protected java.util.Set<ConnectionListener> |
connectionListeners
A collection of ConnectionListeners which listen for connection closing
and reconnection events.
|
protected java.util.concurrent.locks.Lock |
connectionLock |
protected SmackDebugger |
debugger
The SmackDebugger allows to log and debug XML traffic.
|
protected java.lang.String |
host
The used host to establish the connection to
|
protected SynchronizationPoint<java.lang.Exception> |
lastFeaturesReceived
Set to success if the last features stanza from the server has been parsed.
|
protected int |
port
The used port to establish the connection to
|
protected java.io.Reader |
reader
The Reader which is used for the debugger.
|
protected SASLAuthentication |
saslAuthentication
The SASLAuthentication manager that is responsible for authenticating with the server.
|
protected SynchronizationPoint<SmackException> |
saslFeatureReceived
Set to success if the sasl feature has been received.
|
protected java.util.Map<java.lang.String,PacketExtension> |
streamFeatures |
protected java.lang.String |
user
The full JID of the authenticated user.
|
protected boolean |
wasAuthenticated
Flag that indicates if the user was authenticated with the server when the connection
to the server was closed (abruptly or not).
|
protected java.io.Writer |
writer
The Writer which is used for the debugger.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractXMPPConnection(ConnectionConfiguration configuration)
Create a new XMPPConnection to a XMPP server.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionListener(ConnectionListener connectionListener)
Adds a connection listener to this connection that will be notified when
the connection closes or fails.
|
void |
addPacketInterceptor(PacketListener packetInterceptor,
PacketFilter packetFilter)
Registers a packet interceptor with this connection.
|
void |
addPacketListener(PacketListener packetListener,
PacketFilter packetFilter)
Registers a packet listener with this connection.
|
void |
addPacketSendingListener(PacketListener packetListener,
PacketFilter packetFilter)
Registers a packet listener with this connection.
|
protected void |
afterFeaturesReceived() |
protected void |
afterSuccessfulLogin(boolean anonymous,
boolean resumed) |
protected void |
bindResourceAndEstablishSession(java.lang.String resource) |
protected void |
callConnectionAuthenticatedListener() |
protected void |
callConnectionClosedOnErrorListener(java.lang.Exception e) |
protected void |
callConnectionConnectedListener() |
void |
connect()
Establishes a connection to the XMPP server and performs an automatic login
only if the previous connection state was logged (authenticated).
|
protected abstract void |
connectInternal()
Abstract method that concrete subclasses of XMPPConnection need to implement to perform their
way of XMPP connection establishment.
|
PacketCollector |
createPacketCollector(PacketFilter packetFilter)
Creates a new packet collector for this connection.
|
PacketCollector |
createPacketCollectorAndSend(IQ packet)
Creates a new packet collector collecting packets that are replies to
packet. |
PacketCollector |
createPacketCollectorAndSend(PacketFilter packetFilter,
Packet packet)
Creates a new packet collector for this connection.
|
void |
disconnect()
Closes the connection by setting presence to unavailable then closing the connection to
the XMPP server.
|
void |
disconnect(Presence unavailablePresence)
Closes the connection.
|
protected void |
finalize() |
protected void |
firePacketSendingListeners(Packet packet)
Process all packet listeners for sending packets.
|
protected ConnectionConfiguration |
getConfiguration() |
int |
getConnectionCounter()
Get the connection counter of this XMPPConnection instance.
|
protected static java.util.Collection<ConnectionCreationListener> |
getConnectionCreationListeners()
Get the collection of listeners that are interested in connection creation events.
|
abstract java.lang.String |
getConnectionID()
Returns the connection ID for this connection, which is the value set by the server
when opening a XMPP stream.
|
protected java.util.Collection<ConnectionListener> |
getConnectionListeners()
Get the collection of listeners that are interested in connection events.
|
protected java.util.concurrent.locks.Lock |
getConnectionLock() |
<F extends PacketExtension> |
getFeature(java.lang.String element,
java.lang.String namespace)
Get the feature packet extensions for a given stream feature of the
server, or
null if the server doesn't support that feature. |
XMPPConnection.FromMode |
getFromMode()
Get the currently active FromMode.
|
java.lang.String |
getHost()
Returns the host name of the server where the XMPP server is running.
|
long |
getLastStanzaReceived()
Returns the timestamp in milliseconds when the last stanza was received.
|
long |
getPacketReplyTimeout()
Returns the current value of the reply timeout in milliseconds for request for this
XMPPConnection instance.
|
int |
getPort()
Returns the port number of the XMPP server for this connection.
|
Roster |
getRoster()
Returns the roster for the user.
|
RosterStore |
getRosterStore()
Get the permanent roster store.
|
protected SASLAuthentication |
getSASLAuthentication()
Returns the SASLAuthentication manager that is responsible for authenticating with
the server.
|
java.lang.String |
getServiceName()
Returns the name of the service provided by the XMPP server for this connection.
|
java.lang.String |
getUser()
Returns the full XMPP address of the user that is logged in to the connection or
null if not logged in yet.
|
boolean |
hasFeature(java.lang.String element,
java.lang.String namespace)
Return true if the server supports the given stream feature.
|
protected void |
initDebugger()
Initialize the
debugger. |
protected void |
invokePacketCollectorsAndNotifyRecvListeners(Packet packet)
Invoke
PacketCollector.processPacket(Packet) for every
PacketCollector with the given packet. |
boolean |
isAnonymous()
Returns true if currently authenticated anonymously.
|
boolean |
isAuthenticated()
Returns true if currently authenticated by successfully calling the login method.
|
boolean |
isConnected()
Returns true if currently connected to the XMPP server.
|
boolean |
isRosterLoadedAtLogin()
Returns true if the roster will be loaded from the server when logging in.
|
abstract boolean |
isSecureConnection()
Returns true if the connection to the server has successfully negotiated encryption.
|
abstract boolean |
isUsingCompression()
Returns true if network traffic is being compressed.
|
void |
login(java.lang.String username,
java.lang.String password)
Logs in to the server using the strongest authentication mode supported by
the server, then sets presence to available.
|
abstract void |
login(java.lang.String username,
java.lang.String password,
java.lang.String resource)
Logs in to the server using the strongest authentication mode supported by
the server, then sets presence to available.
|
abstract void |
loginAnonymously()
Logs in to the server anonymously.
|
protected void |
maybeResolveDns() |
protected void |
parseFeatures(org.xmlpull.v1.XmlPullParser parser) |
protected void |
processPacket(Packet packet)
Processes a packet after it's been fully parsed by looping through the installed
packet collectors and listeners and letting them examine the packet to see if
they are a match with the filter.
|
void |
removeConnectionListener(ConnectionListener connectionListener)
Removes a connection listener from this connection.
|
void |
removePacketCollector(PacketCollector collector)
Remove a packet collector of this connection.
|
void |
removePacketInterceptor(PacketListener packetInterceptor)
Removes a packet interceptor.
|
boolean |
removePacketListener(PacketListener packetListener)
Removes a packet listener for received packets from this connection.
|
void |
removePacketSendingListener(PacketListener packetListener)
Removes a packet listener for sending packets from this connection.
|
protected void |
reportStanzaReceived() |
abstract void |
send(PlainStreamElement element)
Send a PlainStreamElement.
|
void |
sendIqWithResponseCallback(IQ iqRequest,
PacketListener callback)
Send a IQ stanza and invoke
callback if there is a result of
IQ.Type.result with that result IQ. |
void |
sendIqWithResponseCallback(IQ iqRequest,
PacketListener callback,
ExceptionCallback exceptionCallback)
Send a IQ stanza and invoke
callback if there is a result of
IQ.Type.result with that result IQ. |
void |
sendIqWithResponseCallback(IQ iqRequest,
PacketListener callback,
ExceptionCallback exceptionCallback,
long timeout)
Send a IQ stanza and invoke
callback if there is a result of
IQ.Type.result with that result IQ. |
void |
sendPacket(Packet packet)
Sends the specified packet to the server.
|
protected abstract void |
sendPacketInternal(Packet packet) |
void |
sendStanzaWithResponseCallback(Packet stanza,
PacketFilter replyFilter,
PacketListener callback)
Send a stanza and wait asynchronously for a response by using
replyFilter. |
void |
sendStanzaWithResponseCallback(Packet stanza,
PacketFilter replyFilter,
PacketListener callback,
ExceptionCallback exceptionCallback)
Send a stanza and wait asynchronously for a response by using
replyFilter. |
void |
sendStanzaWithResponseCallback(Packet stanza,
PacketFilter replyFilter,
PacketListener callback,
ExceptionCallback exceptionCallback,
long timeout)
Send a stanza and wait asynchronously for a response by using
replyFilter. |
void |
setFromMode(XMPPConnection.FromMode fromMode)
Set the FromMode for this connection instance.
|
protected void |
setLoginInfo(java.lang.String username,
java.lang.String password,
java.lang.String resource) |
void |
setPacketReplyTimeout(long timeout)
Set the packet reply timeout in milliseconds.
|
protected void |
setServiceName(java.lang.String serviceName) |
protected void |
setWasAuthenticated(boolean authenticated)
Sets whether the connection has already logged in the server.
|
protected abstract void |
shutdown()
Shuts the current connection down.
|
protected final java.util.Set<ConnectionListener> connectionListeners
protected final java.util.concurrent.locks.Lock connectionLock
protected final java.util.Map<java.lang.String,PacketExtension> streamFeatures
protected java.lang.String user
protected boolean connected
protected SmackDebugger debugger
protected java.io.Reader reader
protected java.io.Writer writer
protected final SynchronizationPoint<java.lang.Exception> lastFeaturesReceived
protected final SynchronizationPoint<SmackException> saslFeatureReceived
protected SASLAuthentication saslAuthentication
protected final int connectionCounterValue
protected final ConnectionConfiguration config
protected XMPPInputOutputStream compressionHandler
protected java.lang.String host
protected int port
protected boolean authenticated
protected boolean wasAuthenticated
protected AbstractXMPPConnection(ConnectionConfiguration configuration)
configuration - The configuration which is used to establish the connection.protected static java.util.Collection<ConnectionCreationListener> getConnectionCreationListeners()
protected ConnectionConfiguration getConfiguration()
public java.lang.String getServiceName()
XMPPConnectiongetServiceName in interface XMPPConnectionpublic java.lang.String getHost()
XMPPConnectiongetHost in interface XMPPConnectionpublic int getPort()
XMPPConnectiongetPort in interface XMPPConnectionpublic abstract java.lang.String getConnectionID()
XMPPConnectiongetConnectionID in interface XMPPConnectionpublic abstract boolean isSecureConnection()
XMPPConnectionisSecureConnection in interface XMPPConnectionprotected abstract void sendPacketInternal(Packet packet) throws SmackException.NotConnectedException
public abstract void send(PlainStreamElement element) throws SmackException.NotConnectedException
XMPPConnectionThis 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.
send in interface XMPPConnectionSmackException.NotConnectedExceptionpublic abstract boolean isUsingCompression()
XMPPConnectionisUsingCompression in interface XMPPConnectionpublic void connect()
throws SmackException,
java.io.IOException,
XMPPException
Listeners will be preserved from a previous connection.
XMPPException - if an error occurs on the XMPP protocol level.SmackException - if an error occurs somewhere else besides XMPP protocol level.java.io.IOExceptionSmackException.ConnectionException - with detailed information about the failed connection.protected abstract void connectInternal()
throws SmackException,
java.io.IOException,
XMPPException
SmackExceptionjava.io.IOExceptionXMPPExceptionpublic void login(java.lang.String username,
java.lang.String password)
throws XMPPException,
SmackException,
java.io.IOException
Before logging in (i.e. authenticate) to the server the connection must be connected.
It is possible to log in without sending an initial available presence by using
ConnectionConfiguration.setSendPresence(boolean). If this connection is
not interested in loading its roster upon login then use
ConnectionConfiguration.setRosterLoadedAtLogin(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 using
ConnectionConfiguration.setCallbackHandler(javax.security.auth.callback.CallbackHandler).
For more advanced login settings see ConnectionConfiguration.
username - the username.password - the password or null if using a CallbackHandler.XMPPException - if an error occurs on the XMPP protocol level.SmackException - if an error occurs somehwere else besides XMPP protocol level.java.io.IOExceptionpublic abstract void login(java.lang.String username,
java.lang.String password,
java.lang.String resource)
throws XMPPException,
SmackException,
java.io.IOException
Before logging in (i.e. authenticate) to the server the connection must be connected.
It is possible to log in without sending an initial available presence by using
ConnectionConfiguration.setSendPresence(boolean). If this connection is
not interested in loading its roster upon login then use
ConnectionConfiguration.setRosterLoadedAtLogin(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 using
ConnectionConfiguration.setCallbackHandler(javax.security.auth.callback.CallbackHandler).
For more advanced login settings see ConnectionConfiguration.
username - the username.password - the password or null if using a CallbackHandler.resource - the resource.XMPPException - if an error occurs on the XMPP protocol level.SmackException - if an error occurs somehwere else besides XMPP protocol level.java.io.IOExceptionpublic abstract void loginAnonymously()
throws XMPPException,
SmackException,
java.io.IOException
XMPPException - if an error occurs on the XMPP protocol level.SmackException - if an error occurs somehwere else besides XMPP protocol level.java.io.IOExceptionpublic final boolean isConnected()
XMPPConnectionisConnected in interface XMPPConnectionpublic final boolean isAuthenticated()
XMPPConnectionisAuthenticated in interface XMPPConnectionpublic final java.lang.String getUser()
XMPPConnectiongetUser in interface XMPPConnectionprotected void bindResourceAndEstablishSession(java.lang.String resource)
throws XMPPException.XMPPErrorException,
java.io.IOException,
SmackException
XMPPException.XMPPErrorExceptionjava.io.IOExceptionSmackExceptionprotected void afterSuccessfulLogin(boolean anonymous,
boolean resumed)
throws SmackException.NotConnectedException
public boolean isAnonymous()
XMPPConnectionisAnonymous in interface XMPPConnectionprotected void setServiceName(java.lang.String serviceName)
protected void setLoginInfo(java.lang.String username,
java.lang.String password,
java.lang.String resource)
protected void maybeResolveDns()
throws java.lang.Exception
java.lang.Exceptionprotected java.util.concurrent.locks.Lock getConnectionLock()
public void sendPacket(Packet packet) throws SmackException.NotConnectedException
XMPPConnectionsendPacket in interface XMPPConnectionpacket - the packet to send.SmackException.NotConnectedExceptionpublic Roster getRoster()
XMPPConnection
This method will never return null, instead if the user has not yet logged into
the server or is logged in anonymously all modifying methods of the returned roster object
like Roster.createEntry(String, String, String[]),
Roster.removeEntry(RosterEntry) , etc. except adding or removing
RosterListeners will throw an IllegalStateException.
getRoster in interface XMPPConnectionprotected SASLAuthentication getSASLAuthentication()
public void disconnect()
throws SmackException.NotConnectedException
public void disconnect(Presence unavailablePresence) throws SmackException.NotConnectedException
unavailablePresence - the presence packet to send during shutdown.SmackException.NotConnectedExceptionprotected abstract void shutdown()
public void addConnectionListener(ConnectionListener connectionListener)
XMPPConnectionaddConnectionListener in interface XMPPConnectionconnectionListener - a connection listener.public void removeConnectionListener(ConnectionListener connectionListener)
XMPPConnectionremoveConnectionListener in interface XMPPConnectionconnectionListener - a connection listener.protected java.util.Collection<ConnectionListener> getConnectionListeners()
public PacketCollector createPacketCollectorAndSend(IQ packet) throws SmackException.NotConnectedException
XMPPConnectionpacket.
Does also send packet. The packet filter for the collector is an
IQReplyFilter, guaranteeing that packet id and JID in the 'from' address have
expected values.createPacketCollectorAndSend in interface XMPPConnectionpacket - the packet to filter responses fromSmackException.NotConnectedExceptionpublic PacketCollector createPacketCollectorAndSend(PacketFilter packetFilter, Packet packet) throws SmackException.NotConnectedException
XMPPConnectionPacketListener when you need to wait for
a specific result.createPacketCollectorAndSend in interface XMPPConnectionpacketFilter - the packet filter to use.packet - the packet to send right after the collector got createdSmackException.NotConnectedExceptionpublic PacketCollector createPacketCollector(PacketFilter packetFilter)
XMPPConnectionPacketListener
when you need to wait for a specific result.
Note: If you send a Packet right after using this method, then
consider using
XMPPConnection.createPacketCollectorAndSend(PacketFilter, Packet) instead.
Otherwise make sure cancel the PacketCollector in every case, e.g. even
if an exception is thrown, or otherwise you may leak the PacketCollector.
createPacketCollector in interface XMPPConnectionpacketFilter - the packet filter to use.public void removePacketCollector(PacketCollector collector)
XMPPConnectionremovePacketCollector in interface XMPPConnectioncollector - a packet collectors which was created for this connection.public void addPacketListener(PacketListener packetListener, PacketFilter packetFilter)
XMPPConnectionXMPPConnection.addPacketInterceptor(PacketListener, PacketFilter).addPacketListener in interface XMPPConnectionpacketListener - the packet listener to notify of new received packets.packetFilter - the packet filter to use.public boolean removePacketListener(PacketListener packetListener)
XMPPConnectionremovePacketListener in interface XMPPConnectionpacketListener - the packet listener to remove.public void addPacketSendingListener(PacketListener packetListener, PacketFilter packetFilter)
XMPPConnectionaddPacketSendingListener in interface XMPPConnectionpacketListener - the packet listener to notify of sent packets.packetFilter - the packet filter to use.public void removePacketSendingListener(PacketListener packetListener)
XMPPConnectionremovePacketSendingListener in interface XMPPConnectionpacketListener - the packet listener to remove.protected void firePacketSendingListeners(Packet packet)
Compared to firePacketInterceptors(Packet), the listeners will be invoked in a new thread.
packet - the packet to process.public void addPacketInterceptor(PacketListener packetInterceptor, PacketFilter packetFilter)
XMPPConnection
NOTE: For a similar functionality on incoming packets, see XMPPConnection.addPacketListener(PacketListener, PacketFilter).
addPacketInterceptor in interface XMPPConnectionpacketInterceptor - the packet interceptor to notify of packets about to be sent.packetFilter - the packet filter to use.public void removePacketInterceptor(PacketListener packetInterceptor)
XMPPConnectionremovePacketInterceptor in interface XMPPConnectionpacketInterceptor - the packet interceptor to remove.protected void initDebugger()
debugger. You can specify a customized SmackDebugger
by setup the system property smack.debuggerClass to the implementation.java.lang.IllegalStateException - if the reader or writer isn't yet initialized.java.lang.IllegalArgumentException - if the SmackDebugger can't be loaded.public long getPacketReplyTimeout()
XMPPConnectiongetPacketReplyTimeout in interface XMPPConnectionpublic void setPacketReplyTimeout(long timeout)
XMPPConnectionSmackException.NoResponseException if no reply to a request was received within the timeout period.setPacketReplyTimeout in interface XMPPConnectiontimeout - the packet reply timeout in millisecondsprotected void processPacket(Packet packet)
packet - the packet to process.protected void invokePacketCollectorsAndNotifyRecvListeners(Packet packet)
PacketCollector.processPacket(Packet) for every
PacketCollector with the given packet. Also notify the receive listeners with a matching packet filter about the packet.packet - the packet to notify the PacketCollectors and receive listeners about.protected void setWasAuthenticated(boolean authenticated)
wasAuthenticated flag is never reset once it has ever been set.authenticated - true if the connection has already been authenticated.protected void callConnectionConnectedListener()
protected void callConnectionAuthenticatedListener()
protected void callConnectionClosedOnErrorListener(java.lang.Exception e)
public int getConnectionCounter()
XMPPConnectiongetConnectionCounter in interface XMPPConnectionpublic void setFromMode(XMPPConnection.FromMode fromMode)
XMPPConnectionsetFromMode in interface XMPPConnectionpublic XMPPConnection.FromMode getFromMode()
XMPPConnectiongetFromMode in interface XMPPConnectionXMPPConnection.FromModeprotected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic RosterStore getRosterStore()
XMPPConnectiongetRosterStore in interface XMPPConnectionpublic boolean isRosterLoadedAtLogin()
XMPPConnectionisRosterLoadedAtLogin in interface XMPPConnectionprotected final void parseFeatures(org.xmlpull.v1.XmlPullParser parser)
throws org.xmlpull.v1.XmlPullParserException,
java.io.IOException,
SmackException
org.xmlpull.v1.XmlPullParserExceptionjava.io.IOExceptionSmackExceptionprotected void afterFeaturesReceived()
throws SmackException.SecurityRequiredException,
SmackException.NotConnectedException
public <F extends PacketExtension> F getFeature(java.lang.String element, java.lang.String namespace)
XMPPConnectionnull if the server doesn't support that feature.getFeature in interface XMPPConnectionnullpublic boolean hasFeature(java.lang.String element,
java.lang.String namespace)
XMPPConnectionhasFeature in interface XMPPConnectionpublic void sendStanzaWithResponseCallback(Packet stanza, PacketFilter replyFilter, PacketListener callback) throws SmackException.NotConnectedException
XMPPConnectionreplyFilter.
If there is a response, then callback will be invoked. The callback will be
invoked at most once and it will be not invoked after the connections default reply timeout
has been elapsed.
sendStanzaWithResponseCallback in interface XMPPConnectionstanza - the stanza to send (required)replyFilter - the filter used to determine response stanza (required)callback - the callback invoked if there is a response (required)SmackException.NotConnectedExceptionpublic void sendStanzaWithResponseCallback(Packet stanza, PacketFilter replyFilter, PacketListener callback, ExceptionCallback exceptionCallback) throws SmackException.NotConnectedException
XMPPConnectionreplyFilter.
If there is a response, then callback will be invoked. If there is no response
after the connections default reply timeout, then exceptionCallback will be invoked
with a SmackException.NoResponseException. The callback will be invoked at most once.
sendStanzaWithResponseCallback in interface XMPPConnectionstanza - the stanza to send (required)replyFilter - the filter used to determine response stanza (required)callback - the callback invoked if there is a response (required)exceptionCallback - the callback invoked if there is an exception (optional)SmackException.NotConnectedExceptionpublic void sendStanzaWithResponseCallback(Packet stanza, PacketFilter replyFilter, PacketListener callback, ExceptionCallback exceptionCallback, long timeout) throws SmackException.NotConnectedException
XMPPConnectionreplyFilter.
If there is a response, then callback will be invoked. If there is no response
after timeout milliseconds, then exceptionCallback will be invoked
with a SmackException.NoResponseException. The callback will be invoked at most once.
sendStanzaWithResponseCallback in interface XMPPConnectionstanza - the stanza to send (required)replyFilter - the filter used to determine response stanza (required)callback - the callback invoked if there is a response (required)exceptionCallback - the callback invoked if there is an exception (optional)timeout - the timeout in milliseconds to wait for a responseSmackException.NotConnectedExceptionpublic void sendIqWithResponseCallback(IQ iqRequest, PacketListener callback) throws SmackException.NotConnectedException
XMPPConnectioncallback if there is a result of
IQ.Type.result with that result IQ. The callback will
not be invoked after the connections default reply timeout has been elapsed.sendIqWithResponseCallback in interface XMPPConnectioniqRequest - the IQ stanza to send (required)callback - the callback invoked if there is result response (required)SmackException.NotConnectedExceptionpublic void sendIqWithResponseCallback(IQ iqRequest, PacketListener callback, ExceptionCallback exceptionCallback) throws SmackException.NotConnectedException
XMPPConnectioncallback if there is a result of
IQ.Type.result with that result IQ. If there is an
error response exceptionCallback will be invoked, if not null, with the received
error as XMPPException.XMPPErrorException. If there is no response after the
connections default reply timeout, then exceptionCallback will be invoked with a
SmackException.NoResponseException.sendIqWithResponseCallback in interface XMPPConnectioniqRequest - the IQ stanza to send (required)callback - the callback invoked if there is result response (required)exceptionCallback - the callback invoked if there is an Exception optionalSmackException.NotConnectedExceptionpublic void sendIqWithResponseCallback(IQ iqRequest, PacketListener callback, ExceptionCallback exceptionCallback, long timeout) throws SmackException.NotConnectedException
XMPPConnectioncallback if there is a result of
IQ.Type.result with that result IQ. If there is an
error response exceptionCallback will be invoked, if not null, with the received
error as XMPPException.XMPPErrorException. If there is no response after
timeout, then exceptionCallback will be invoked with a
SmackException.NoResponseException.sendIqWithResponseCallback in interface XMPPConnectioniqRequest - the IQ stanza to send (required)callback - the callback invoked if there is result response (required)exceptionCallback - the callback invoked if there is an Exception optionaltimeout - the timeout in milliseconds to wait for a responseSmackException.NotConnectedExceptionpublic long getLastStanzaReceived()
XMPPConnectiongetLastStanzaReceived in interface XMPPConnectionprotected void reportStanzaReceived()