SocketUtils was officially deprecated in 5.3.16 (#28052) and removed in 6.0 M3 (#28054); however, there is still need for a subset of this functionality in integration tests for testing scenarios in which it is not possible for the system under test to select its own random port (or rely on the operating system to provide an ephemeral port).

We will therefore introduce a scaled down version in spring-test called TestSocketUtils, supporting retrieval of a single TCP port, and potentially with a simple retry mechanism that allows test code using the available port to be retried a given number of times if an exception is thrown.

Comment From: asibross

Was this added to any 5.3.x version?

Comment From: sbrannen

Was this added to any 5.3.x version?

No, this issue is still open and assigned to the 5.3.x backlog.

Comment From: artemptushkin

Spring boot 3 is coming and this would be really needed, any chance we can raise the priority?

Comment From: sbrannen

  • Superseded by #29132