Thursday, 15 August 2013

Some questions about interfaces

Some questions about interfaces

question 1:
if SSLSocketFactory is an interface, then what does it mean by
" private static SSLSocketFactory TRUSTED_FACTORY;" ?
what is TRUSTED_FACTORY? An interface instance?
question 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 is javax.net.ssl.TrustManager , and X509TrustManager is
javax.net.ssl.X509TrustManager.I know X509TrustManager is an
child-interface of TrustManager, Why can we Instantiate an interface using
keyword "new"? And , what's the meaning by declare some functions like
getAcceptedIssuers/checkClientTrusted when instantiate this interface?

No comments:

Post a Comment