exception.expect(TransmissionException.class);
exception.expectMessage("[407]");
KeyStore ks = readKeyStore(getKeyStoreUrlOne(), getKeyStorePassword(), "JKS");
SslTunnel tunnel = new SslTunnel(ks, getKeyStorePassword(), 9898, "localhost", 9797);
tunnel.start();
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")
.trustStoreUrl(getKeyStoreUrlOne())
.trustStorePassword(getKeyStorePassword())
.build();
try {
verifyServiceBehavior(1, new ClientBuilder() {
@Override
public SoapClient buildClient(String endpointUrl) {
return SoapClient.builder().endpointUri("http://" + endpointUrl)
.proxyUri("https://127.0.0.1:" + 9898)
.proxySecurity(props)
.build();
}
});
} finally {
tunnel.stop();
proxyServer.stop();
}
}