mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-16 13:09:34 +08:00
add test
This commit is contained in:
parent
7882b3b485
commit
a38d7b47ab
@ -35,8 +35,8 @@ import java.security.SecureRandom;
|
||||
* <ul>
|
||||
* <li>协议(protocol),默认TLS</li>
|
||||
* <li>{@link KeyManager},默认空</li>
|
||||
* <li>{@link TrustManager},默认{@link TrustAnyTrustManager},即信任全部</li>
|
||||
* <li>{@link SecureRandom}</li>
|
||||
* <li>{@link TrustManager},默认{@code null}</li>
|
||||
* <li>{@link SecureRandom},默认{@code null}</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* 构建后可获得{@link SSLContext},通过调用{@link SSLContext#getSocketFactory()}获取{@link javax.net.ssl.SSLSocketFactory}
|
||||
@ -49,8 +49,8 @@ public class SSLContextBuilder implements SSLProtocols, Builder<SSLContext> {
|
||||
|
||||
private String protocol = TLS;
|
||||
private KeyManager[] keyManagers;
|
||||
private TrustManager[] trustManagers = TrustManagerUtil.TRUST_ANYS;
|
||||
private SecureRandom secureRandom = new SecureRandom();
|
||||
private TrustManager[] trustManagers;
|
||||
private SecureRandom secureRandom;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,14 @@
|
||||
package org.dromara.hutool.core.net.ssl;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
public class SSLContextUtilTest {
|
||||
@Test
|
||||
void createTrustAnySSLContextTest() {
|
||||
final SSLContext trustAnySSLContext = SSLContextUtil.createTrustAnySSLContext();
|
||||
Assertions.assertNotNull(trustAnySSLContext);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user