最近学习使用httpunit,遇到一个基本验证的问题。请求大虾们帮忙分析一下。我明明已经用setAuthentication方法设定了基本验证的帐号密码。但运行程序时系统还报错说我未提供基本验证信息。代码如下:package src;
import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
public class Test1 { public static void main(String[] args) {
// TODO Auto-generated method stub
try{
WebConversation wc = new WebConversation();
             WebRequest req = new GetMethodWebRequest( "http://wzxxx.gicp.net:8500/" );
             wc.setAuthentication("TP-LINK Router R410", "admin", "123456");    
        WebResponse   resp = wc.getResponse( req );
        System.out.print(resp.toString());
                System.out.println("program end");
}catch(Exception e){e.printStackTrace();}
}
}错误如下:
com.meterware.httpunit.AuthorizationRequiredException: Basic authentication required: {realm="TP-LINK Router R410"}
at com.meterware.httpunit.AuthorizationRequiredException.createException(AuthorizationRequiredException.java:40)
at com.meterware.httpunit.AuthenticationChallenge.createAuthorizationRequiredException(AuthenticationChallenge.java:81)
at com.meterware.httpunit.AuthenticationChallenge.createException(AuthenticationChallenge.java:42)
at com.meterware.httpunit.WebClient.createResponse(WebClient.java:655)
at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:220)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:181)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:158)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:122)
at src.Test1.main(Test1.java:20)