In some cases one needs to obtain a port number on which there is no Derby network server.
Today this is solved in an ad-hoc way, for instance by using the current port minus one. When running tests in parallel, there is a chance that a port where there actually is a Derby network server listening is picked.
As a start, I suggest that the bogus port is allocated to the last port in the port range configured for the run: baseport + MAX_PORTS_USED -1.
- is related to
DERBY-4747 ttestSetPortPriority junit test failing in tinderbox runs with junit.framework.AssertionFailedError: Port 1537 exceeeds expected maximum.