updateAddressPort(bethal, PORT2);
// Okay, I'm sick of configuration files.
// This also tests dynamic configuration of the conduit.
Client client = ClientProxy.getClient(bethal);
HTTPConduit http =
(HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setAutoRedirect(false);
// If we set any name, but Edward, Mary, or George,
// and a password of "password" we will get through
// Bethal.
AuthorizationPolicy authPolicy = new AuthorizationPolicy();
authPolicy.setUserName("Betty");
authPolicy.setPassword("password");
http.setClient(httpClientPolicy);
http.setTlsClientParameters(tlsClientParameters);
http.setAuthorization(authPolicy);
// Our expected server should be OU=Bethal
http.setTrustDecider(new MyHttpsTrustDecider("Bethal"));
String answer = bethal.sayHi();
assertTrue("Unexpected answer: " + answer,
"Bonjour from Bethal".equals(answer));
// Nobody will not equal OU=Bethal
MyHttpsTrustDecider trustDecider =
new MyHttpsTrustDecider("Nobody");
http.setTrustDecider(trustDecider);
try {
answer = bethal.sayHi();
fail("Unexpected answer from Bethal: " + answer);
} catch (Exception e) {
//e.printStackTrace();