@Test public void testIsKeepAlive() throws Exception { MultiMap headers = MultiMap.caseInsensitiveMultiMap(); HttpServerRequest req = mock(HttpServerRequest.class); when(req.headers()).thenReturn(headers); headers.add(HeaderNames.CONNECTION, HttpUtils.CLOSE); assertThat(HttpUtils.isKeepAlive(req)).isFalse(); headers.add(HeaderNames.CONNECTION, HttpUtils.KEEP_ALIVE); assertThat(HttpUtils.isKeepAlive(req)).isTrue(); headers.clear(); when(req.version()).thenReturn(HttpVersion.HTTP_1_1); assertThat(HttpUtils.isKeepAlive(req)).isTrue(); when(req.version()).thenReturn(HttpVersion.HTTP_1_0); assertThat(HttpUtils.isKeepAlive(req)).isFalse(); }
public static boolean isKeepAlive(HttpServerRequest request) { String connection = request.headers().get(HeaderNames.CONNECTION); if (connection != null && connection.equalsIgnoreCase(CLOSE)) { return false; } if (request.version() == HttpVersion.HTTP_1_1) { return !CLOSE.equalsIgnoreCase(connection); } else { return KEEP_ALIVE.equalsIgnoreCase(connection); } }
HttpUtils { public static boolean isKeepAlive(HttpServerRequest request) { String connection = request.headers().get(HeaderNames.CONNECTION); if (connection != null && connection.equalsIgnoreCase(CLOSE)) { return false; } if (request.version() == HttpVersion.HTTP_1_1) { return !CLOSE.equalsIgnoreCase(connection); } else { return KEEP_ALIVE.equalsIgnoreCase(connection); } } }
HttpUtils { public static boolean isKeepAlive(HttpServerRequest request) { String connection = request.headers().get(HeaderNames.CONNECTION); if (connection != null && connection.equalsIgnoreCase(CLOSE)) { return false; } if (request.version() == HttpVersion.HTTP_1_1) { return !CLOSE.equalsIgnoreCase(connection); } else { return KEEP_ALIVE.equalsIgnoreCase(connection); } }  }
HttpUtils { public static boolean isKeepAlive(HttpServerRequest request) { String connection = request.headers().get(HeaderNames.CONNECTION); if (connection != null && connection.equalsIgnoreCase(CLOSE)) { return false; } if (request.version() == HttpVersion.HTTP_1_1) { return !CLOSE.equalsIgnoreCase(connection); } else { return KEEP_ALIVE.equalsIgnoreCase(connection); } }  static boolean isKeepAlive(HttpServerRequest request); static int getStatusFromResult(Result result, boolean success); static InputStream processResult(ServiceAccessor accessor, Context context, Renderable renderable,
                                            Result result); static String getContentTypeFromContentTypeAndCharacterSetting(String rawContentType); static boolean isPostOrPut(HttpServerRequest request); }
HttpUtils { public static boolean isKeepAlive(HttpServerRequest request) { String connection = request.headers().get(HeaderNames.CONNECTION); if (connection != null && connection.equalsIgnoreCase(CLOSE)) { return false; } if (request.version() == HttpVersion.HTTP_1_1) { return !CLOSE.equalsIgnoreCase(connection); } else { return KEEP_ALIVE.equalsIgnoreCase(connection); } }  static boolean isKeepAlive(HttpServerRequest request); static int getStatusFromResult(Result result, boolean success); static InputStream processResult(ServiceAccessor accessor, Context context, Renderable renderable,
                                            Result result); static String getContentTypeFromContentTypeAndCharacterSetting(String rawContentType); static boolean isPostOrPut(HttpServerRequest request); static final String CLOSE; static final String KEEP_ALIVE; }