Skip to content

Commit

Permalink
[grid] It seems that keep-alive works well in Passthrough, so deletin…
Browse files Browse the repository at this point in the history
…g this test
  • Loading branch information
barancev committed Aug 30, 2018
1 parent ed716b5 commit 751aae7
Showing 1 changed file with 0 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static java.net.HttpURLConnection.HTTP_OK;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import com.google.common.io.ByteStreams;

Expand Down Expand Up @@ -71,22 +70,6 @@ public void shouldForwardRequestsToEndPoint() throws IOException {
assertEquals("Cake", server.lastRequest.getHeader("x-cheese"));
}

@Test
public void shouldStripKeepAliveHeader() throws IOException {
SessionCodec handler = new Passthrough(server.url);
HttpRequest req = new HttpRequest(HttpMethod.GET, "/ok");
req.addHeader("Keep-Alive", "timeout=600");
req.addHeader("Connection", "Keep-Alive, Upgrade");
HttpResponse resp = new HttpResponse();
handler.handle(req, resp);

assertNull(server.lastRequest.getHeader("keep-alive"));
// Not, we must set the connection to `close` in order to have the JVM avoid attempting to keep
// the url connection open.
// http://docs.oracle.com/javase/6/docs/technotes/guides/net/http-keepalive.html
assertEquals("close", server.lastRequest.getHeader("connection"));
}

private static class Server {
private final URL url;
private final HttpServer server;
Expand Down

0 comments on commit 751aae7

Please sign in to comment.