问题1:
如果 SSLSocketFactory 是一个接口,那么它是什么意思
" private static SSLSocketFactory TRUSTED_FACTORY;" ?
TRUSTED_FACTORY 是什么?接口实例?
问题2:
final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(X509Certificate[] chain, String authType) {
// Intentionally left blank
}
public void checkServerTrusted(X509Certificate[] chain, String authType) {
// Intentionally left blank
}
} };
TrustManager 是 javax.net.ssl.TrustManager ,而 X509TrustManager 是 javax.net.ssl.X509TrustManager。我知道 X509TrustManager 是 TrustManager 的子接口,为什么我们可以使用关键字“new”来实例化接口?还有,在实例化这个接口的时候声明getAcceptedIssuers/checkClientTrusted等函数是什么意思?