Credentials cred = new UsernamePasswordCredentials("username","password");
Credentials cred2 = new UsernamePasswordCredentials("uname2","password2");
Header authChallenge = new BasicHeader(AUTH.WWW_AUTH, challenge1);
HttpRequest request = new BasicHttpRequest("Simple", "/");
AuthScheme authscheme = new DigestScheme();
authscheme.processChallenge(authChallenge);
Header authResponse = authscheme.authenticate(cred, request);
Map<String, String> table = parseAuthResponse(authResponse);
assertEquals("username", table.get("username"));
assertEquals("realm1", table.get("realm"));
assertEquals("/", table.get("uri"));
assertEquals("abcde", table.get("nonce"));
assertEquals("786f500303eac1478f3c2865e676ed68", table.get("response"));
authChallenge = new BasicHeader(AUTH.WWW_AUTH, challenge2);
AuthScheme authscheme2 = new DigestScheme();
authscheme2.processChallenge(authChallenge);
authResponse = authscheme2.authenticate(cred2, request);
table = parseAuthResponse(authResponse);
assertEquals("uname2", table.get("username"));
assertEquals("realm2", table.get("realm"));
assertEquals("/", table.get("uri"));