Code example for BasicHeader

0
public class TestBasicScheme { 
 
    @Test(expected=MalformedChallengeException.class) 
    public void testBasicAuthenticationWithNoRealm() throws Exception { 
        String challenge = "Basic";
        Header header = new BasicHeader(AUTH.WWW_AUTH, challenge);
        AuthScheme authscheme = new BasicScheme();
        authscheme.processChallenge(header);
    } 
 
    @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);
Contextual code suggestions in your IDE  Get Codota for Java