@Test public void keepAliveDefaultValueIfMore() { final List<Header> headers = new ArrayList<Header>(1); headers.add(new BasicHeader("Keep-Alive", "timeout=8")); Mockito.when(httpResponse.headerIterator(Mockito.anyString())).thenReturn(new BasicListHeaderIterator( headers, null)); final long keepAlive = subject.getKeepAliveDuration(httpResponse, httpContext); MatcherAssert.assertThat(keepAlive, Matchers.is(5000l)); }
public long getKeepAliveDuration(final HttpResponse response, final HttpContext context) { final long result = super.getKeepAliveDuration(response, context); if (result < 0) { return maxKeepAliveDuration; } else { return Math.min(result, maxKeepAliveDuration); } }
NexusConnectionKeepAliveStrategy extends DefaultConnectionKeepAliveStrategy { public long getKeepAliveDuration(final HttpResponse response, final HttpContext context) { final long result = super.getKeepAliveDuration(response, context); if (result < 0) { return maxKeepAliveDuration; } else { return Math.min(result, maxKeepAliveDuration); } } }
NexusConnectionKeepAliveStrategy extends DefaultConnectionKeepAliveStrategy { public long getKeepAliveDuration(final HttpResponse response, final HttpContext context) { final long result = super.getKeepAliveDuration(response, context); if (result < 0) { return maxKeepAliveDuration; } else { return Math.min(result, maxKeepAliveDuration); } } NexusConnectionKeepAliveStrategy(final long maxKeepAliveDuration); }
NexusConnectionKeepAliveStrategy extends DefaultConnectionKeepAliveStrategy { public long getKeepAliveDuration(final HttpResponse response, final HttpContext context) { final long result = super.getKeepAliveDuration(response, context); if (result < 0) { return maxKeepAliveDuration; } else { return Math.min(result, maxKeepAliveDuration); } } NexusConnectionKeepAliveStrategy(final long maxKeepAliveDuration); long getKeepAliveDuration(final HttpResponse response, final HttpContext context); }
NexusConnectionKeepAliveStrategy extends DefaultConnectionKeepAliveStrategy { public long getKeepAliveDuration(final HttpResponse response, final HttpContext context) { final long result = super.getKeepAliveDuration(response, context); if (result < 0) { return maxKeepAliveDuration; } else { return Math.min(result, maxKeepAliveDuration); } } NexusConnectionKeepAliveStrategy(final long maxKeepAliveDuration); long getKeepAliveDuration(final HttpResponse response, final HttpContext context);  }