|
|
|
@ -58,22 +58,26 @@ import static org.junit.Assert.assertTrue;
|
|
|
|
|
|
|
|
|
|
public class HttpClientConnectionTest { |
|
|
|
|
@Test |
|
|
|
|
public void testGetHeaderFieldsAllowMultipleValues() throws MalformedURLException { |
|
|
|
|
public void testGetHeaderFieldsAllowMultipleValues() |
|
|
|
|
throws MalformedURLException { |
|
|
|
|
HttpResponse responseMock = new HttpResponseMock(); |
|
|
|
|
String headerField = "WWW-Authenticate"; |
|
|
|
|
responseMock.addHeader(headerField, "Basic"); |
|
|
|
|
responseMock.addHeader(headerField, "Digest"); |
|
|
|
|
responseMock.addHeader(headerField, "NTLM"); |
|
|
|
|
HttpClientConnection connection = new HttpClientConnection("http://0.0.0.0/"); |
|
|
|
|
HttpClientConnection connection = new HttpClientConnection( |
|
|
|
|
"http://0.0.0.0/"); |
|
|
|
|
connection.resp = responseMock; |
|
|
|
|
List<String> headerValues = connection.getHeaderFields().get(headerField); |
|
|
|
|
List<String> headerValues = connection.getHeaderFields() |
|
|
|
|
.get(headerField); |
|
|
|
|
assertEquals(3, headerValues.size()); |
|
|
|
|
assertTrue(headerValues.contains("Basic")); |
|
|
|
|
assertTrue(headerValues.contains("Digest")); |
|
|
|
|
assertTrue(headerValues.contains("NTLM")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private class HttpResponseMock extends AbstractHttpMessage implements HttpResponse { |
|
|
|
|
private class HttpResponseMock extends AbstractHttpMessage |
|
|
|
|
implements HttpResponse { |
|
|
|
|
@Override |
|
|
|
|
public StatusLine getStatusLine() { |
|
|
|
|
return null; |
|
|
|
@ -90,7 +94,8 @@ public class HttpClientConnectionTest {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void setStatusLine(ProtocolVersion protocolVersion, int i, String s) { |
|
|
|
|
public void setStatusLine(ProtocolVersion protocolVersion, int i, |
|
|
|
|
String s) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|