Throw exception to reduce call sites of notifyConnectionError()

in XMPPTCPConnection.
This commit is contained in:
Florian Schmaus 2019-03-07 09:49:16 +01:00
parent 7d2c3ac9f9
commit 5da6dea138
1 changed files with 3 additions and 4 deletions

View File

@ -973,14 +973,13 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
@Override
protected void afterFeaturesReceived() throws NotConnectedException, InterruptedException {
protected void afterFeaturesReceived() throws NotConnectedException, InterruptedException, SecurityRequiredByServerException {
StartTls startTlsFeature = getFeature(StartTls.ELEMENT, StartTls.NAMESPACE);
if (startTlsFeature != null) {
if (startTlsFeature.required() && config.getSecurityMode() == SecurityMode.disabled) {
SmackException smackException = new SecurityRequiredByServerException();
SecurityRequiredByServerException smackException = new SecurityRequiredByServerException();
tlsHandled.reportFailure(smackException);
notifyConnectionError(smackException);
return;
throw smackException;
}
if (config.getSecurityMode() != ConnectionConfiguration.SecurityMode.disabled) {