@Deprecated public class DeployerSocketUtils extends Object
localhost.
This is a replacement for SocketUtils. SocketUtils was introduced in Spring Framework 4.0,
primarily to assist in writing integration tests which start an external server on an available random port.
However, these utilities make no guarantee about the subsequent availability
of a given port and are therefore unreliable. Instead of using SocketUtils to
find an available local port for a server, it is recommended that you rely on a
server's ability to start on a random port that it selects or is assigned by the operating system.
To interact with that server, you should query the server for the port it is currently using.| Constructor and Description |
|---|
DeployerSocketUtils()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
findAvailableTcpPort(int minPort)
Deprecated.
Find an available TCP port randomly selected from the range [
minPort,
]. |
static int |
findAvailableTcpPort(int minPort,
int maxPort)
Deprecated.
Find an available TCP port randomly selected from the range [
minPort,
maxPort]. |
static SortedSet<Integer> |
findAvailableTcpPorts(int numRequested,
int minPort,
int maxPort)
Deprecated.
Find the requested number of available TCP ports, each randomly selected from the
range [
minPort, maxPort]. |
public static int findAvailableTcpPort(int minPort)
minPort,
].minPort - the minimum port numberIllegalStateException - if no available port could be foundpublic static int findAvailableTcpPort(int minPort,
int maxPort)
minPort,
maxPort].minPort - the minimum port numbermaxPort - the maximum port numberIllegalStateException - if no available port could be foundpublic static SortedSet<Integer> findAvailableTcpPorts(int numRequested, int minPort, int maxPort)
minPort, maxPort].numRequested - the number of available ports to findminPort - the minimum port numbermaxPort - the maximum port numberIllegalStateException - if the requested number of available ports could not
be foundCopyright © 2023 Pivotal Software, Inc.. All rights reserved.