public int getRelativePort(int i) {
        if (ports.isEmpty()) {
            throw new IllegalStateException("Requested port with offset " + i + " for service that " +
                                            "has not reserved any ports: " + this);
        }
        if (i >= ports.size()) {
            throw new IllegalStateException("Requested port with offset " + i + " for service that " +
                                            "only has reserved " + ports.size() + " ports: " + this);
        }
        return ports.get(i);
    }
Computes and returns the i'th port for this service, based on this Service's baseport.

@param i the offset from 'basePort' of the port to return
@return the i'th port relative to the base port.
@throws IllegalStateException if i is out of range.
config-model/src/main/java/com/yahoo/vespa/model/AbstractService.java