findAvailablePort
Finds and returns an available port on the local machine.
This method opens a temporary server socket to identify an unused port and ensures that the port is released immediately after identification.
Return
an integer representing an available port number on the local machine