* @return appropriate endpoint from a list of indexed endpoints or null
*/
protected Endpoint selectIndexedEndpoint(List<IndexedEndpoint> endpoints) {
List<IndexedEndpoint> endpointsCopy = new ArrayList<IndexedEndpoint>(endpoints);
Iterator<IndexedEndpoint> endpointItr = endpointsCopy.iterator();
IndexedEndpoint firstNoDefaultEndpoint = null;
IndexedEndpoint currentEndpoint;
while (endpointItr.hasNext()) {
currentEndpoint = endpointItr.next();
// endpoint is the default endpoint
if (currentEndpoint.isDefault() != null) {
if (currentEndpoint.isDefault()) {
return currentEndpoint;
}
if (firstNoDefaultEndpoint == null) {
firstNoDefaultEndpoint = currentEndpoint;