HttpState state = new HttpState();
UsernamePasswordCredentials cred = new UsernamePasswordCredentials("username","password");
state.setCredentials("realm1", null, cred);
UsernamePasswordCredentials cred2 = new UsernamePasswordCredentials("uname2","password2");
state.setCredentials("realm2", null, cred2);
AuthScheme authscheme1 = new DigestScheme();
authscheme1.processChallenge(challenge1);
AuthScheme authscheme2 = new DigestScheme();
authscheme2.processChallenge(challenge2);
{
HttpMethod method = new SimpleHttpMethod(new Header("WWW-Authenticate",challenge1));
assertTrue(authenticate(authscheme1, method, null, state));
assertTrue(null != method.getRequestHeader("Authorization"));
Map table = AuthChallengeParser.extractParams(method.getRequestHeader("Authorization").getValue());