mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add method for #1348
This commit is contained in:
@@ -1,26 +1,27 @@
|
||||
package cn.hutool.http.ssl;
|
||||
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import static cn.hutool.http.ssl.SSLSocketFactoryBuilder.SSLv3;
|
||||
import static cn.hutool.http.ssl.SSLSocketFactoryBuilder.TLSv1;
|
||||
import static cn.hutool.http.ssl.SSLSocketFactoryBuilder.TLSv11;
|
||||
import static cn.hutool.http.ssl.SSLSocketFactoryBuilder.TLSv12;
|
||||
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/**
|
||||
* 兼容android低版本SSL连接
|
||||
* 咱在测试HttpUrlConnection的时候
|
||||
* 发现一部分手机无法连接[GithubPage]
|
||||
* 兼容android低版本SSL连接<br>
|
||||
* 在测试HttpUrlConnection的时候,发现一部分手机无法连接[GithubPage]
|
||||
*
|
||||
* <p>
|
||||
* 最后发现原来是某些SSL协议没有开启
|
||||
*
|
||||
* @author MikaGuraNTK
|
||||
*/
|
||||
public class AndroidSupportSSLFactory extends CustomProtocolsSSLFactory {
|
||||
|
||||
// Android低版本不重置的话某些SSL访问就会失败
|
||||
private static final String[] protocols = {SSLv3, TLSv1, TLSv11, TLSv12};
|
||||
|
||||
|
||||
public AndroidSupportSSLFactory() throws KeyManagementException, NoSuchAlgorithmException {
|
||||
super(protocols);
|
||||
}
|
||||
|
Reference in New Issue
Block a user