fixed test that failed on second boundary
This commit is contained in:
parent
57b6debb87
commit
7acbb05060
|
@ -24,14 +24,19 @@
|
|||
*/
|
||||
package org.eclipse.jetty.server;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringReader;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -278,16 +283,43 @@ public class HttpConnectionTest
|
|||
"Connection: close\015\012"+
|
||||
"\015\012");
|
||||
|
||||
assertThat(responsePOST,startsWith(responseHEAD.substring(0,responseHEAD.length()-2)));
|
||||
assertThat(responsePOST.length(),greaterThan(responseHEAD.length()));
|
||||
String postLine;
|
||||
boolean postDate=false;
|
||||
Set<String> postHeaders = new HashSet<>();
|
||||
try(BufferedReader in = new BufferedReader(new StringReader(responsePOST)))
|
||||
{
|
||||
postLine = in.readLine();
|
||||
String line=in.readLine();
|
||||
while (line!=null && line.length()>0)
|
||||
{
|
||||
if (line.startsWith("Date:"))
|
||||
postDate=true;
|
||||
else
|
||||
postHeaders.add(line);
|
||||
line=in.readLine();
|
||||
}
|
||||
}
|
||||
String headLine;
|
||||
boolean headDate=false;
|
||||
Set<String> headHeaders = new HashSet<>();
|
||||
try(BufferedReader in = new BufferedReader(new StringReader(responseHEAD)))
|
||||
{
|
||||
headLine = in.readLine();
|
||||
String line=in.readLine();
|
||||
while (line!=null && line.length()>0)
|
||||
{
|
||||
if (line.startsWith("Date:"))
|
||||
headDate=true;
|
||||
else
|
||||
headHeaders.add(line);
|
||||
line=in.readLine();
|
||||
}
|
||||
}
|
||||
|
||||
responsePOST=connector.getResponses("POST /R1 HTTP/1.1\015\012"+
|
||||
"Host: localhost\015\012"+
|
||||
"Connection: close\015\012"+
|
||||
"\015\012");
|
||||
assertThat(postLine,equalTo(headLine));
|
||||
assertThat(postDate,equalTo(headDate));
|
||||
assertTrue(postHeaders.equals(headHeaders));
|
||||
|
||||
assertThat(responsePOST,startsWith(responseHEAD.substring(0,responseHEAD.length()-2)));
|
||||
assertThat(responsePOST.length(),greaterThan(responseHEAD.length()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue