@Test
public void wrongAuth() throws IOException {

    for (String val : new String[] { "cm9sYW5kOmJsdWI=", "Blub"}) {
        expect(request.getHeader("Authorization")).andReturn("Basic " + val);
        response.setHeader(eq("WWW-Authenticate"), EasyMock.<String>anyObject());
        response.sendError(401);
        replay(request, response);
        assertFalse(context.handleSecurity(request, response));
        reset(request,response);
    }
}