public ACLClient(final DiscoveryServiceClient discoveryServiceClient) {
this.baseURI = new Supplier<URI>() {
@Override
public URI get() {
Iterable<Discoverable> serviceDiscovered = discoveryServiceClient.discover(Constants.Service.ACL);
TimeLimitEndpointStrategy strategy = new TimeLimitEndpointStrategy(
new RandomEndpointStrategy(serviceDiscovered), 5, TimeUnit.SECONDS);
Preconditions.checkNotNull(strategy.pick(), "No discoverable endpoint found for ACLService");
InetSocketAddress socketAddress = strategy.pick().getSocketAddress();
try {
// TODO: support https by checking router ssl enabled from Configuration
String url = String.format("http://%s:%d", socketAddress.getAddress().getHostName(), socketAddress.getPort());
return new URI(url);
} catch (URISyntaxException e) {