fixed lint error

This commit is contained in:
Mariotaku Lee 2017-05-13 08:52:54 +08:00
parent 5828cd9063
commit 4f027b4af7
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
1 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,6 @@
package org.mariotaku.twidere.util.net;
import android.os.Build;
import android.support.annotation.RequiresApi;
import java.io.IOException;
import java.net.InetAddress;
@ -35,7 +34,6 @@ import javax.net.ssl.SSLSocketFactory;
/**
* @author fkrauthan
*/
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN)
public class TLSSocketFactory extends SSLSocketFactory {
private SSLSocketFactory internalSSLSocketFactory;
@ -87,9 +85,11 @@ public class TLSSocketFactory extends SSLSocketFactory {
}
private Socket enableTLSOnSocket(Socket socket) {
if(socket != null && (socket instanceof SSLSocket)) {
((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2"});
if (socket == null || (!(socket instanceof SSLSocket))) {
return socket;
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return socket;
((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"});
return socket;
}
}