@Test
public void testBasicAuthHeaderAddedToRequestWhenUserInfoPresentInUri() throws Exception {

    final Func1<String, Observable<HttpClientRequest<ByteBuf>>> createPost = MesosClient.curryCreatePost(
        URI.create("http://testuser:testpassword@localhost:12345/api/v1/scheduler"),
        StringMessageCodec.UTF8_STRING,
        StringMessageCodec.UTF8_STRING,
        new UserAgent(
            literal("testing", "latest")
        ),
        new AtomicReference<>(null)
    );
    final HttpClientRequest<ByteBuf> request = createPost.call("something")
        .toBlocking()
        .first();
    final String authHeaderName = HttpHeaderNames.AUTHORIZATION.toString();
    final Map<String, String> headers = headersToMap(request.getHeaders());
    assertThat(headers).containsKeys(authHeaderName);
    final String authorization = headers.get(authHeaderName);
    assertThat(authorization).isEqualTo("Basic dGVzdHVzZXI6dGVzdHBhc3N3b3Jk");
    final String base64UserPass = authorization.substring("Basic ".length());
    final String userPass = new String(Base64.getDecoder().decode(base64UserPass));
    assertThat(userPass).isEqualTo("testuser:testpassword");
}