NegotiateAuthenticationFilter extends AuthenticatingFilter { void sendChallengeDuringNegotiate(final String protocol, final ServletResponse response, final byte[] out) { final List<String> protocolsList = new ArrayList<>(); protocolsList.add(protocol); this.sendChallenge(protocolsList, response, out); } NegotiateAuthenticationFilter(); String getRememberMeParam(); void setRememberMeParam(final String value); String getFailureKeyAttribute(); void setFailureKeyAttribute(final String value);  }
@Test void testSendChallengeDuringNegotiate() { final String myProtocol = "myProtocol"; this.out = new byte[1]; this.out[0] = -1; this.negAuthFilter.sendChallengeDuringNegotiate(myProtocol, this.response, this.out); Assertions.assertEquals(String.join(" ", myProtocol, Base64.getEncoder().encodeToString(this.out)), this.response.headers.get("WWW-Authenticate")); Assertions.assertEquals("keep-alive", this.response.headers.get("Connection")); Assertions.assertEquals(HttpServletResponse.SC_UNAUTHORIZED, this.response.sc); Assertions.assertEquals(0, this.response.errorCode); Assertions.assertFalse(this.response.isFlushed); }