1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Throw exceptions of SSLSocket.startHandshake() in connect()

instead of throwing a NoResponseException in case startHandshake()
throws an Exception. The NoResponseException was then thrown when
performing SASL auth, which usually directly followes securing the
connection via TLS (if enabled and provided by the server).
This commit is contained in:
Florian Schmaus 2014-04-28 08:29:12 +02:00
parent ddb47c2d60
commit bc176d72a3
3 changed files with 32 additions and 5 deletions

View file

@ -218,6 +218,11 @@ public abstract class XMPPConnection {
private boolean bindingRequired;
private boolean sessionSupported;
/**
*
*/
private IOException connectionException;
/**
* Create an executor to deliver incoming packets to listeners. We'll use a single thread with an unbounded queue.
*/
@ -355,6 +360,7 @@ public abstract class XMPPConnection {
saslAuthentication.init();
bindingRequired = false;
sessionSupported = false;
connectionException = null;
connectInternal();
}
@ -485,6 +491,18 @@ public abstract class XMPPConnection {
return userJID;
}
protected void setConnectionException(IOException exception) {
connectionException = exception;
}
protected void throwConnectionExceptionOrNoResponse() throws IOException, NoResponseException {
if (connectionException != null) {
throw connectionException;
} else {
throw new NoResponseException();
}
}
/**
* Sends the specified packet to the server.
*