Skip to content

Commit

Permalink
Demonstrate that the TimeOut response is repeated.
Browse files Browse the repository at this point in the history
  • Loading branch information
cispr committed Feb 20, 2017
1 parent 43ee962 commit 55fd04d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/test/java/org/littleshoot/proxy/KeepAliveTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import java.util.Locale;
import java.util.concurrent.TimeUnit;

import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.startsWith;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -226,6 +224,16 @@ public void testGatewayTimeoutDoesNotCloseConnection() throws IOException, Inter

String response = SocketClientUtil.readStringFromSocket(socket);

assertThat("The response is repeated:", response, is("HTTP/1.1 504 Gateway Timeout\r\n" +
"Content-Length: 15\r\n" +
"Content-Type: text/html; charset=utf-8\r\n" +
"\r\n" +
"Gateway TimeoutHTTP/1.1 504 Gateway Timeout\r\n" +
"Content-Length: 15\r\n" +
"Content-Type: text/html; charset=utf-8\r\n" +
"\r\n" +
"Gateway Timeout"));

assertThat("Expected to receive an HTTP 200 from the server (iteration: " + i + ")", response, startsWith("HTTP/1.1 504 Gateway Timeout"));
}

Expand Down

0 comments on commit 55fd04d

Please sign in to comment.