1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 12:02:05 +01:00

Move duplicate code in AbstractXMPPConnection

from XMPP(TCP|BOSH)Connection.
This commit is contained in:
Florian Schmaus 2016-11-12 11:03:44 +01:00
parent 489a48bf86
commit 013f4d630a
4 changed files with 9 additions and 12 deletions

View file

@ -198,11 +198,6 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
+ getHost() + ":" + getPort() + "."; + getHost() + ":" + getPort() + ".";
throw new SmackException(errorMessage); throw new SmackException(errorMessage);
} }
// Wait with SASL auth until the SASL mechanisms have been received
saslFeatureReceived.checkIfSuccessOrWaitOrThrow();
callConnectionConnectedListener();
} }
public boolean isSecureConnection() { public boolean isSecureConnection() {

View file

@ -369,6 +369,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
// Perform the actual connection to the XMPP service // Perform the actual connection to the XMPP service
connectInternal(); connectInternal();
// Wait with SASL auth until the SASL mechanisms have been received
saslFeatureReceived.checkIfSuccessOrWaitOrThrow();
// Make note of the fact that we're now connected.
connected = true;
callConnectionConnectedListener();
return this; return this;
} }

View file

@ -90,6 +90,7 @@ public class DummyConnection extends AbstractXMPPConnection {
@Override @Override
protected void connectInternal() { protected void connectInternal() {
connected = true; connected = true;
saslFeatureReceived.reportSuccess();
streamId = "dummy-" + new Random(new Date().getTime()).nextInt(); streamId = "dummy-" + new Random(new Date().getTime()).nextInt();
if (reconnect) { if (reconnect) {

View file

@ -885,13 +885,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
// We connected successfully to the servers TCP port // We connected successfully to the servers TCP port
initConnection(); initConnection();
// Wait with SASL auth until the SASL mechanisms have been received
saslFeatureReceived.checkIfSuccessOrWaitOrThrow();
// Make note of the fact that we're now connected.
connected = true;
callConnectionConnectedListener();
} }
/** /**