当前在公司网络内部工作,我需要访问特定服务器的API才能使用RestAssured进行测试。
尝试设置NTLM代理失败,并且出现407错误,显示“凭据丢失”
我尝试将代理添加为JVM参数:
-Dhttp.proxyHost=pxyHost -Dhttp.proxyPort=pxyPort -Dhttp.proxyUser=username -Dhttp.proxyPassword=password
我还尝试了如下将代理添加到RestAssured:
ProxySpecification proxySpec = new ProxySpecification(pxyHost,port,scheme);
proxySpec.withAuth(username,password);
RestAssured.proxy(proxySpec);
或
RestAssured.proxy(proxySpec.withAuth(username,password);
尝试将系统代理设置为:
System.setProperty("http.proxyHost",pxyHost);
System.setProperty("http.proxyPort",pxyPort);
System.setProperty("http.proxyUser",username);
System.setProperty("http.proxyPassword",password);
最后还尝试设置身份验证器:
Authenticator.setDefault( new Authenticator(){
@Override
public Passwordauthentication getPasswordauthentication() {
return new Passwordauthentication(username,password.toCharArray());
}});
关于如何实现验证的任何指针?任何帮助将不胜感激,已经解决了很长时间,我似乎在网上找不到合适的解决方案。 :(
谢谢!