private WrappedDiscoverable getDiscoverable(final HttpRequest httpRequest,
final InetSocketAddress address) {
EndpointStrategy strategy = serviceLookup.getDiscoverable(address.getPort(), httpRequest);
if (strategy == null) {
throw new HandlerException(HttpResponseStatus.SERVICE_UNAVAILABLE,
String.format("No endpoint strategy found for request : %s",
httpRequest.getUri()));
}
Discoverable discoverable = strategy.pick();
if (discoverable == null) {
throw new HandlerException(HttpResponseStatus.SERVICE_UNAVAILABLE,
String.format("No discoverable found for request : %s",
httpRequest.getUri()));
}
return new WrappedDiscoverable(discoverable);
}