public String toBasicHeader(){
        return "Basic " + new String(Base64.getEncoder().encode((getUser() + ":" + getPass()).
                getBytes(Charset.defaultCharset())), Charset.defaultCharset());
    }
@Test
    public void testToBasicHeader() {
        Authorization basicAuthorization = new Authorization("http://example.com", "foo", "bar", null, "Test Realm",
                Mechanism.BASIC);
        assertThat(basicAuthorization.toBasicHeader(), CoreMatchers.is("Basic Zm9vOmJhcg=="));
    }