better error checking in ssl switch over
Conflicts: src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
This commit is contained in:
parent
ac4eabbd22
commit
f41f3b120c
|
@ -18,6 +18,8 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
import java.net.IDN;
|
||||||
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
@ -553,12 +555,15 @@ public class XmppConnection implements Runnable {
|
||||||
|
|
||||||
HostnameVerifier verifier = this.mXmppConnectionService.getMemorizingTrustManager().wrapHostnameVerifier(new StrictHostnameVerifier());
|
HostnameVerifier verifier = this.mXmppConnectionService.getMemorizingTrustManager().wrapHostnameVerifier(new StrictHostnameVerifier());
|
||||||
|
|
||||||
if (socket == null) {
|
if (socket == null || socket.isClosed()) {
|
||||||
throw new IOException("socket was null");
|
throw new IOException("socket null or closed");
|
||||||
}
|
}
|
||||||
SSLSocket sslSocket = (SSLSocket) factory.createSocket(socket,
|
final InetAddress address = socket.getInetAddress();
|
||||||
socket.getInetAddress().getHostAddress(), socket.getPort(),
|
if (address == null) {
|
||||||
true);
|
throw new IOException("socket address was null");
|
||||||
|
}
|
||||||
|
|
||||||
|
final SSLSocket sslSocket = (SSLSocket) factory.createSocket(socket,address.getHostAddress(), socket.getPort(),true);
|
||||||
|
|
||||||
// Support all protocols except legacy SSL.
|
// Support all protocols except legacy SSL.
|
||||||
// The min SDK version prevents us having to worry about SSLv2. In
|
// The min SDK version prevents us having to worry about SSLv2. In
|
||||||
|
|
Loading…
Reference in a new issue