Package org.jivesoftware.smack.c2s
Class ModularXmppClientToServerConnection
- java.lang.Object
-
- org.jivesoftware.smack.AbstractXMPPConnection
-
- org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection
-
- All Implemented Interfaces:
XMPPConnection
public final class ModularXmppClientToServerConnection extends AbstractXMPPConnection
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ModularXmppClientToServerConnection.AuthenticatedAndResourceBoundStateDescriptor
static class
ModularXmppClientToServerConnection.AuthenticatedButUnboundStateDescriptor
static class
ModularXmppClientToServerConnection.ConnectedButUnauthenticatedStateDescriptor
static class
ModularXmppClientToServerConnection.DisconnectedStateDescriptor
static class
ModularXmppClientToServerConnection.LookupRemoteConnectionEndpointsStateDescriptor
static class
ModularXmppClientToServerConnection.ResourceBindingStateDescriptor
static class
ModularXmppClientToServerConnection.ResourceBoundResult
static class
ModularXmppClientToServerConnection.SaslAuthenticationStateDescriptor
static class
ModularXmppClientToServerConnection.SaslAuthenticationSuccessResult
static class
ModularXmppClientToServerConnection.Stats
-
Nested classes/interfaces inherited from class org.jivesoftware.smack.AbstractXMPPConnection
AbstractXMPPConnection.InterceptorWrapper, AbstractXMPPConnection.ListenerWrapper, AbstractXMPPConnection.SyncPointState
-
Nested classes/interfaces inherited from interface org.jivesoftware.smack.XMPPConnection
XMPPConnection.FromMode
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
streamResumed
-
Fields inherited from class org.jivesoftware.smack.AbstractXMPPConnection
ASYNC_BUT_ORDERED, authenticated, authenticatedConnectionInitiallyEstablishedTimestamp, closingStreamReceived, compressionHandler, config, connected, connectionCounterValue, connectionListeners, connectionLock, currentSmackException, currentXmppException, debugger, host, inOrderListeners, lastFeaturesReceived, outgoingStreamXmlEnvironment, port, reader, saslFeatureReceived, SMACK_REACTOR, streamFeatures, streamId, tlsHandled, user, wasAuthenticated, writer
-
-
Constructor Summary
Constructors Constructor Description ModularXmppClientToServerConnection(ModularXmppClientToServerConnectionConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConnectionStateMachineListener(ConnectionStateMachineListener connectionStateMachineListener)
protected void
afterFeaturesReceived()
protected WalkStateGraphContext.Builder
buildNewWalkTo(Class<? extends StateDescriptor> finalStateClass)
protected void
connectInternal()
Abstract method that concrete subclasses of XMPPConnection need to implement to perform their way of XMPP connection establishment.ModularXmppClientToServerConnectionConfiguration
getConfiguration()
Get the connection configuration used by this connection.<CM extends ModularXmppClientToServerConnectionModule<? extends ModularXmppClientToServerConnectionModuleDescriptor>>
CMgetConnectionModuleFor(Class<? extends ModularXmppClientToServerConnectionModuleDescriptor> descriptorClass)
protected Map<String,Object>
getFilterStats()
protected SSLSession
getSSLSession()
ModularXmppClientToServerConnection.Stats
getStats()
void
instantShutdown()
Performs an unclean disconnect and shutdown of the connection.protected void
invokeConnectionStateMachineListener(ConnectionStateEvent connectionStateEvent)
boolean
isSecureConnection()
Returns true if the connection to the server has successfully negotiated encryption.boolean
isUsingCompression()
Returns true if network traffic is being compressed.protected void
loginInternal(String username, String password, Resourcepart resource)
protected void
newStreamOpenWaitForFeaturesSequence(String waitFor)
protected void
parseAndProcessElement(String element)
protected void
prepareToWaitForFeaturesReceived()
boolean
removeConnectionStateMachineListener(ConnectionStateMachineListener connectionStateMachineListener)
void
sendNonza(Nonza nonza)
Send a Nonza.protected void
sendStanzaInternal(Stanza stanza)
protected void
shutdown()
Shuts the current connection down.protected void
waitForFeaturesReceived(String waitFor)
protected void
walkStateGraph(WalkStateGraphContext walkStateGraphContext)
-
Methods inherited from class org.jivesoftware.smack.AbstractXMPPConnection
addAsyncStanzaListener, addConnectionListener, addMessageInterceptor, addOneTimeSyncCallback, addPresenceInterceptor, addStanzaInterceptor, addStanzaListener, addStanzaSendingListener, addStreamFeature, addSyncStanzaListener, afterSaslAuthenticationSuccess, afterSuccessfulLogin, asyncGo, asyncGoLimited, authenticate, bindResourceAndEstablishSession, buildNonzaCallback, callConnectionAuthenticatedListener, callConnectionConnectedListener, callConnectionConnectingListener, connect, createStanzaCollector, createStanzaCollector, createStanzaCollectorAndSend, createStanzaCollectorAndSend, disconnect, disconnect, firePacketSendingListeners, getAuthenticatedConnectionInitiallyEstablishedTimestamp, getConnectionCounter, getConnectionLock, getFeature, getFromMode, getHost, getLastStanzaReceived, getParsingExceptionCallback, getPort, getReactor, getReplyTimeout, getSmackTlsContext, getStanzaFactory, getStreamId, getUsedSaslMechansism, getUser, getXMPPServiceDomain, hasCurrentConnectionException, hasFeature, initDebugger, initState, invokeStanzaCollectorsAndNotifyRecvListeners, isAnonymous, isAuthenticated, isConnected, isSaslAuthenticated, login, login, login, notifyConnectionError, notifyWaitingThreads, onStreamOpen, parseAndProcessNonza, parseAndProcessStanza, parseFeatures, parseFeaturesAndNotify, processStanza, registerIQRequestHandler, removeAsyncStanzaListener, removeConnectionListener, removeMessageInterceptor, removePresenceInterceptor, removeStanzaCollector, removeStanzaInterceptor, removeStanzaListener, removeStanzaSendingListener, removeSyncStanzaListener, schedule, sendAndWaitForResponse, sendAsync, sendAsync, sendIqRequestAndWaitForResponse, sendIqRequestAsync, sendIqRequestAsync, sendStanza, sendStreamOpen, setCurrentConnectionExceptionAndNotify, setFromMode, setMaxAsyncOperations, setParsingExceptionCallback, setReplyTimeout, setUnknownIqRequestReplyMode, setWasAuthenticated, throwAlreadyConnectedExceptionIfAppropriate, throwAlreadyLoggedInExceptionIfAppropriate, throwCurrentConnectionException, throwNotConnectedExceptionIfAppropriate, throwNotConnectedExceptionIfAppropriate, toString, trySendStanza, trySendStanza, unregisterIQRequestHandler, unregisterIQRequestHandler, waitFor, waitForClosingStreamTagFromServer, waitForConditionOrThrowConnectionException
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.smack.XMPPConnection
getFeature, getFeature, hasFeature
-
-
-
-
Field Detail
-
streamResumed
protected boolean streamResumed
-
-
Constructor Detail
-
ModularXmppClientToServerConnection
public ModularXmppClientToServerConnection(ModularXmppClientToServerConnectionConfiguration configuration)
-
-
Method Detail
-
getConnectionModuleFor
public <CM extends ModularXmppClientToServerConnectionModule<? extends ModularXmppClientToServerConnectionModuleDescriptor>> CM getConnectionModuleFor(Class<? extends ModularXmppClientToServerConnectionModuleDescriptor> descriptorClass)
-
loginInternal
protected void loginInternal(String username, String password, Resourcepart resource) throws XMPPException, SmackException, IOException, InterruptedException
- Specified by:
loginInternal
in classAbstractXMPPConnection
- Throws:
XMPPException
SmackException
IOException
InterruptedException
-
buildNewWalkTo
protected WalkStateGraphContext.Builder buildNewWalkTo(Class<? extends StateDescriptor> finalStateClass)
-
walkStateGraph
protected void walkStateGraph(WalkStateGraphContext walkStateGraphContext) throws XMPPException, IOException, SmackException, InterruptedException
-
sendStanzaInternal
protected void sendStanzaInternal(Stanza stanza) throws SmackException.NotConnectedException, InterruptedException
- Specified by:
sendStanzaInternal
in classAbstractXMPPConnection
- Throws:
SmackException.NotConnectedException
InterruptedException
-
sendNonza
public void sendNonza(Nonza nonza) throws SmackException.NotConnectedException, InterruptedException
Description copied from interface:XMPPConnection
Send 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:
sendNonza
in interfaceXMPPConnection
- Specified by:
sendNonza
in classAbstractXMPPConnection
- Parameters:
nonza
- the Nonza to send.- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
shutdown
protected void shutdown()
Description copied from class:AbstractXMPPConnection
Shuts the current connection down.- Specified by:
shutdown
in classAbstractXMPPConnection
-
instantShutdown
public void instantShutdown()
Description copied from class:AbstractXMPPConnection
Performs an unclean disconnect and shutdown of the connection. Does not send a closing stream stanza.- Specified by:
instantShutdown
in classAbstractXMPPConnection
-
getConfiguration
public ModularXmppClientToServerConnectionConfiguration getConfiguration()
Description copied from class:AbstractXMPPConnection
Get the connection configuration used by this connection.- Overrides:
getConfiguration
in classAbstractXMPPConnection
- Returns:
- the connection configuration.
-
getSSLSession
protected SSLSession getSSLSession()
-
afterFeaturesReceived
protected void afterFeaturesReceived()
- Overrides:
afterFeaturesReceived
in classAbstractXMPPConnection
-
parseAndProcessElement
protected void parseAndProcessElement(String element)
-
prepareToWaitForFeaturesReceived
protected void prepareToWaitForFeaturesReceived()
-
waitForFeaturesReceived
protected void waitForFeaturesReceived(String waitFor) throws InterruptedException, SmackException, XMPPException
-
newStreamOpenWaitForFeaturesSequence
protected void newStreamOpenWaitForFeaturesSequence(String waitFor) throws InterruptedException, SmackException, XMPPException
-
isUsingCompression
public boolean isUsingCompression()
Description copied from interface:XMPPConnection
Returns 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:
isUsingCompression
in interfaceXMPPConnection
- Specified by:
isUsingCompression
in classAbstractXMPPConnection
- Returns:
- true if network traffic is being compressed.
-
addConnectionStateMachineListener
public void addConnectionStateMachineListener(ConnectionStateMachineListener connectionStateMachineListener)
-
removeConnectionStateMachineListener
public boolean removeConnectionStateMachineListener(ConnectionStateMachineListener connectionStateMachineListener)
-
invokeConnectionStateMachineListener
protected void invokeConnectionStateMachineListener(ConnectionStateEvent connectionStateEvent)
-
isSecureConnection
public boolean isSecureConnection()
Description copied from interface:XMPPConnection
Returns true if the connection to the server has successfully negotiated encryption.- Specified by:
isSecureConnection
in interfaceXMPPConnection
- Specified by:
isSecureConnection
in classAbstractXMPPConnection
- Returns:
- true if a secure connection to the server.
-
connectInternal
protected void connectInternal() throws SmackException, IOException, XMPPException, InterruptedException
Description copied from class:AbstractXMPPConnection
Abstract 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).- Specified by:
connectInternal
in classAbstractXMPPConnection
- 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.
-
getFilterStats
protected Map<String,Object> getFilterStats()
-
getStats
public ModularXmppClientToServerConnection.Stats getStats()
-
-