@Test
public void testBasicAuthentication() throws Exception {
DirectProvider ep = new DirectProvider();
Topology topology = ep.newTopology();
String url = "http://httpbin.org/basic-auth/";
TStream<Integer> rc = HttpStreams.<String,Integer>requests(
topology.strings("A", "B"),
() -> HttpClients.basic("usA", "pwdA4"),
t-> HttpGet.METHOD_NAME,
t-> url + "us" + t + "/pwd" + t + "4",
(t,resp) -> resp.getStatusLine().getStatusCode());
Tester tester = topology.getTester();
Condition<List<Integer>> endCondition = tester.streamContents(rc, 200, 401);
tester.complete(ep, new JsonObject(), endCondition, 10, TimeUnit.SECONDS);
assertTrue(endCondition.getResult().toString(), endCondition.valid());
}