}
@Override
public Server pick()
{
final ServiceInstance instance;
try {
instance = serviceProvider.getInstance();
}
catch (Exception e) {
log.info(e, "Exception getting instance");
return null;
}
if (instance == null) {
log.error("No server instance found");
return null;
}
return new Server()
{
@Override
public String getHost()
{
return String.format("%s:%d", getAddress(), getPort());
}
@Override
public String getAddress()
{
return instance.getAddress();
}
@Override
public int getPort()
{
return instance.getPort();
}
@Override
public String getScheme()
{