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 classModularXmppClientToServerConnection.AuthenticatedAndResourceBoundStateDescriptorstatic classModularXmppClientToServerConnection.AuthenticatedButUnboundStateDescriptorstatic classModularXmppClientToServerConnection.ConnectedButUnauthenticatedStateDescriptorstatic classModularXmppClientToServerConnection.DisconnectedStateDescriptorstatic classModularXmppClientToServerConnection.LookupRemoteConnectionEndpointsStateDescriptorstatic classModularXmppClientToServerConnection.ResourceBindingStateDescriptorstatic classModularXmppClientToServerConnection.ResourceBoundResultstatic classModularXmppClientToServerConnection.SaslAuthenticationStateDescriptorstatic classModularXmppClientToServerConnection.SaslAuthenticationSuccessResultstatic classModularXmppClientToServerConnection.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 booleanstreamResumed-
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 voidaddConnectionStateMachineListener(ConnectionStateMachineListener connectionStateMachineListener)protected voidafterFeaturesReceived()protected WalkStateGraphContext.BuilderbuildNewWalkTo(Class<? extends StateDescriptor> finalStateClass)protected voidconnectInternal()Abstract method that concrete subclasses of XMPPConnection need to implement to perform their way of XMPP connection establishment.ModularXmppClientToServerConnectionConfigurationgetConfiguration()Get the connection configuration used by this connection.<CM extends ModularXmppClientToServerConnectionModule<? extends ModularXmppClientToServerConnectionModuleDescriptor>>
CMgetConnectionModuleFor(Class<? extends ModularXmppClientToServerConnectionModuleDescriptor> descriptorClass)protected Map<String,Object>getFilterStats()protected SSLSessiongetSSLSession()ModularXmppClientToServerConnection.StatsgetStats()voidinstantShutdown()Performs an unclean disconnect and shutdown of the connection.protected voidinvokeConnectionStateMachineListener(ConnectionStateEvent connectionStateEvent)booleanisSecureConnection()Returns true if the connection to the server has successfully negotiated encryption.booleanisUsingCompression()Returns true if network traffic is being compressed.protected voidloginInternal(String username, String password, Resourcepart resource)protected voidnewStreamOpenWaitForFeaturesSequence(String waitFor)protected voidparseAndProcessElement(String element)protected voidprepareToWaitForFeaturesReceived()booleanremoveConnectionStateMachineListener(ConnectionStateMachineListener connectionStateMachineListener)voidsendNonza(Nonza nonza)Send a Nonza.protected voidsendStanzaInternal(Stanza stanza)protected voidshutdown()Shuts the current connection down.protected voidwaitForFeaturesReceived(String waitFor)protected voidwalkStateGraph(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, waitForConditionOrConnectionException, waitForConditionOrConnectionException, 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:
loginInternalin classAbstractXMPPConnection- Throws:
XMPPExceptionSmackExceptionIOExceptionInterruptedException
-
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:
sendStanzaInternalin classAbstractXMPPConnection- Throws:
SmackException.NotConnectedExceptionInterruptedException
-
sendNonza
public 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- Specified by:
sendNonzain 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:AbstractXMPPConnectionShuts the current connection down.- Specified by:
shutdownin classAbstractXMPPConnection
-
instantShutdown
public void instantShutdown()
Description copied from class:AbstractXMPPConnectionPerforms an unclean disconnect and shutdown of the connection. Does not send a closing stream stanza.- Specified by:
instantShutdownin classAbstractXMPPConnection
-
getConfiguration
public ModularXmppClientToServerConnectionConfiguration getConfiguration()
Description copied from class:AbstractXMPPConnectionGet the connection configuration used by this connection.- Overrides:
getConfigurationin classAbstractXMPPConnection- Returns:
- the connection configuration.
-
getSSLSession
protected SSLSession getSSLSession()
-
afterFeaturesReceived
protected void afterFeaturesReceived()
- Overrides:
afterFeaturesReceivedin 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: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- Specified by:
isUsingCompressionin 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:XMPPConnectionReturns true if the connection to the server has successfully negotiated encryption.- Specified by:
isSecureConnectionin interfaceXMPPConnection- Specified by:
isSecureConnectionin classAbstractXMPPConnection- Returns:
- true if a secure connection to the server.
-
connectInternal
protected void connectInternal() throws SmackException, IOException, XMPPException, InterruptedException
Description copied from class:AbstractXMPPConnectionAbstract 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:
connectInternalin 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()
-
-