mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-28 11:42:15 -05:00
better error checking in ssl switch over
This commit is contained in:
parent
2067b9bd8d
commit
f18f3086af
@ -21,6 +21,7 @@ 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.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;
|
||||||
@ -574,12 +575,15 @@ public class XmppConnection implements Runnable {
|
|||||||
|
|
||||||
final HostnameVerifier verifier = this.mXmppConnectionService.getMemorizingTrustManager().wrapHostnameVerifier(new StrictHostnameVerifier());
|
final 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");
|
||||||
}
|
}
|
||||||
final 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 New Issue
Block a user