}
//Verify that instances of HttpsEndpoint and SslEndpoint
//with trusted socket factories are trusted.
httpsEndpoint = HttpsEndpoint.getInstance(
InetAddress.getLocalHost().getHostAddress(), port,
new TestSocketFactory(true));
sslEndpoint = SslEndpoint.getInstance(
InetAddress.getLocalHost().getHostAddress(), port,
new TestSocketFactory(true));
if (!verifier.isTrustedObject(httpsEndpoint,ctx)){
throw new TestException("HttpsEndpoint instance"
+ " with trusted socket factory is considered untrusted");
}
if (!verifier.isTrustedObject(sslEndpoint,ctx)){
throw new TestException("SslEndpoint instance"
+ " with trusted factory is considered untrusted");
}
//Verify that instances of HttpsEndpoint and SslEndpoint with
//untrusted socket factories are not trusted.
httpsEndpoint = HttpsEndpoint.getInstance(
InetAddress.getLocalHost().getHostAddress(), port,
new TestSocketFactory(false));
sslEndpoint = SslEndpoint.getInstance(
InetAddress.getLocalHost().getHostAddress(), port,
new TestSocketFactory(false));
if (verifier.isTrustedObject(httpsEndpoint,ctx)){
throw new TestException("HttpsEndpoint instance"
+ " with untrusted socket factory is considered trusted");
}
if (verifier.isTrustedObject(sslEndpoint,ctx)){