Renat Sabitov created HTTPCLIENT-1652:
-----------------------------------------
Summary: AuthSchemeBase.challengeState doesn't survive
serialisation in BasicAuthCache
Key: HTTPCLIENT-1652
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1652
Project: HttpComponents HttpClient
Issue Type: Bug
Components: HttpAuth
Affects Versions: 4.4.1
Reporter: Renat Sabitov
If a BasicScheme with ChallengeState defined is put in a BasicAuthCache, it
comes out of the cache with null challengeState.
This is a small test to demonstrate the problem:
{code}
@Test
public void assertChallengeStateSurvivesSerialisation() throws Exception {
BasicAuthCache localCache = new BasicAuthCache();
HttpHost aHost = new HttpHost("sample.host", 80);
BasicScheme proxyScheme = new BasicScheme();
proxyScheme.processChallenge(
new BasicHeader(HttpHeaders.PROXY_AUTHENTICATE, "Basic "));
assertThat(proxyScheme.getChallengeState(), is(ChallengeState.PROXY));
localCache.put(aHost, proxyScheme);
BasicScheme outOfCache = (BasicScheme) localCache.get(aHost);
assertThat(outOfCache.getChallengeState(), is(ChallengeState.PROXY));
}
{code}
result is:
{noformat}
java.lang.AssertionError:
Expected: is <PROXY>
but: was null
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]