private int DefaultPortSelector(int lastPort, int time) { if (time == 0) { return ListenerPortStart; } if (time > 2) { throw new InvalidOperationException("Cannot select port for redirect url"); } return lastPort + 1; }