Index: TestAuthenticator.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAuthenticator.java,v retrieving revision 1.24 diff -u -r1.24 TestAuthenticator.java --- TestAuthenticator.java 7 Apr 2003 19:23:36 -0000 1.24 +++ TestAuthenticator.java 20 Apr 2003 23:25:52 -0000 @@ -484,6 +484,25 @@ assertEquals(expected, method.getRequestHeader("Authorization").getValue()); } + + public void testNTLMAuthenticationRetry() throws Exception { + NTCredentials cred = new NTCredentials("username", "password", "host", "domain"); + HttpState state = new HttpState(); + state.setCredentials(null, null, cred); + HttpMethod method = new SimpleHttpMethod(); + SimpleHttpConnection conn = new SimpleHttpConnection(); + conn.addResponse( + "HTTP/1.1 401 Unauthorized\r\n" + + "WWW-Authenticate: NTLM\r\n" + + "Connection: close\r\n" + "Server: HttpClient Test/2.0\r\n"); + conn.addResponse( + "HTTP/1.1 401 Unauthorized\r\n" + "WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAAAAACgAAAABggAAU3J2Tm9uY2UAAAAAAAAAAA==\r\n" + "Connection: close\r\n" + "Server: HttpClient Test/2.0\r\n"); + conn.addResponse( + "HTTP/1.1 200 OK\r\n" + "Connection: close\r\n" + "Server: HttpClient Test/2.0\r\n" + "stuff\r\n"); + method.execute(state, conn); + assertNull("WWW-Authenticate"); + assertEquals(200, method.getStatusCode()); + } /** * Test that the Unauthorized response is returned when doAuthentication is false.