FlowFilter implements HttpFilter { @Override public void doFilter(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws IOException, ServletException { flow.readFrom(request::getHeader); if (isLegacyRequest(request)) { flow.writeTo(response::setHeader); } chain.doFilter(request, response); } FlowFilter(final Flow flow); @Override void doFilter(final HttpServletRequest request, final HttpServletResponse response,
            final FilterChain chain);  }
@Test void shouldDenyNonHttpRequest() { assertThrows(IllegalArgumentException.class, () -> filter.doFilter(mock(ServletRequest.class), mock(HttpServletResponse.class), null)); }
@Test void shouldDenyNonHttpResponse() { assertThrows(IllegalArgumentException.class, () -> filter.doFilter(mock(HttpServletRequest.class), mock(ServletResponse.class), null)); }