Reserve a specific port for an application. If your application requires a specific port - for example, port 80 for a web
server - you should reserve this port before starting your application. Using this method, you will be able to detect if
another application has already claimed this port number.
portNumber - the required port number.
true if the port was successfully reserved; false if it has been previously reserved.
Reserve a port for your application, with a port number in a specific range. If your application requires a port, but it does
not mind exactly which port number - for example, a port for internal JMX monitoring - call this method.
range - the range of acceptable port numbers.
the port number that has been reserved, or -1 if there was no available port in the acceptable range.