public void testService1_httpProxy_basicAuthentication_failure() throws Exception {
exception.expect(TransmissionException.class);
exception.expectMessage("[407]");
HttpProxyServer proxyServer = initProxy();
proxyServer.addProxyAuthenticationHandler(new ProxyAuthorizationHandler() {
@Override
public boolean authenticate(String user, String pass) {
return user.equals("tom") && pass.equals("007");
}
});
final Security props = Security.builder()
.authBasic("james", "003")
.build();
try {
verifyServiceBehavior(1, new ClientBuilder() {
@Override
public SoapClient buildClient(String endpointUrl) {
return SoapClient.builder().endpointUri("http://" + endpointUrl)
.proxyUri("http://127.0.0.1:" + PROXY_PORT)
.proxySecurity(props)
.build();
}
});
} finally {
proxyServer.stop();
}
}