docs: private synchronized String getMatchingURI(String incomingURI) {
          String[] incomingURIParts = incomingURI.split("/");
  
          ArrayList<String[]> tockenizedEndpoints = new ArrayList<String[]>();
          for (String endpointURI : serverEndpointConfigMap.keySet()) {
              // Since the endpoint paths are either relative URIs or URI templates level 1, the paths do not match if they 
              // do not have the same number of segments, using ’/’ as the separator.
              if (incomingURIParts.length == endpointURI.split("/").length) {
                  tockenizedEndpoints.add(endpointURI.split("/"));
              }
          }
  
          /**
           * For each segment of the incoming uri, compare the corresponding segment of every endpoint uri. If matched (exact match or variable {} match)
           * add that endpoint to the list of matchedURI. Move to next segment of the incoming uri and do the same match. At the end of this loop
           * we have list of possible matched endpoints for the incoming URI
           * For e.g if the incoming uri = a/b/d and endpoints are /{var}/b/d, /a/x/y, {var}/b/{var}, /a/{var}/{var}, /{var}/{var}/{var} then
           * possible matchedURIs are /{var}/b/d, {var}/b/{var}, /a/{var}/{var}, /{var}/{var}/{var}
           */
          for (int i = 1; i < incomingURIParts.length; i++) { // start with i=1 skipping the first part because first part of split("/") for /../../.. is always an empty string 
              ArrayList<String[]> matchedURIs = new ArrayList<String[]>();
              // for a each segment in incomingURI, check the corresponding segment of every endpoint.
              for (int j = 0; j < tockenizedEndpoints.size(); j++) {
                  String[] tockens = tockenizedEndpoints.get(j);
                  if (incomingURIParts[i].equals(tockens[i])) {
                      matchedURIs.add(tockenizedEndpoints.get(j));
                  }
                  if (tockens[i].startsWith("{") && (tockens[i].endsWith("}"))) {
                      matchedURIs.add(tockenizedEndpoints.get(j));
                  }
              }
              tockenizedEndpoints.clear();
              tockenizedEndpoints.addAll(matchedURIs);
          }
  
          //sort matched endpoints in order of preference from left to right for exact match at each segment giving a higher precedence 
          if (tockenizedEndpoints.size() > 1) {
              Collections.sort(tockenizedEndpoints, COMPARATOR);
          }
  
          String[] tockenizedEndpoint = null;
          if (!tockenizedEndpoints.isEmpty()) {
              tockenizedEndpoint = tockenizedEndpoints.get(0); //best match is always the top element in the sorted list
          }
  
          if (tockenizedEndpoint != null) {
              return unTockenizeEp(tockenizedEndpoint);
          } else {
              return null;
          }
      }