BasicScheme extends RFC2617Scheme { public Header authenticate( final Credentials credentials, final HttpRequest request) throws AuthenticationException { if (credentials == null) { throw new IllegalArgumentException("Credentials may not be null"); } if (request == null) { throw new IllegalArgumentException("HTTP request may not be null"); } String charset = AuthParams.getCredentialCharset(request.getParams()); return authenticate(credentials, charset, isProxy()); } BasicScheme(); String getSchemeName(); @Override void processChallenge(
            final Header header); boolean isComplete(); boolean isConnectionBased(); Header authenticate(
            final Credentials credentials,
            final HttpRequest request); static Header authenticate(
            final Credentials credentials,
            final String charset,
            boolean proxy);  }
@Test public void testBasicAuthenticationWith88591Chars() throws Exception { int[] germanChars = { 0xE4, 0x2D, 0xF6, 0x2D, 0xFc }; StringBuilder buffer = new StringBuilder(); for (int i = 0; i < germanChars.length; i++) { buffer.append((char)germanChars[i]); } UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("dh", buffer.toString()); Header header = BasicScheme.authenticate(credentials, "ISO-8859-1", false); Assert.assertEquals("Basic ZGg65C32Lfw=", header.getValue()); }