public class ServerSocketUtil extends Object
ServerSocket
bound to
a random unused port.Constructor and Description |
---|
ServerSocketUtil() |
Modifier and Type | Method and Description |
---|---|
static ServerSocket |
createServerSocket()
Creates a new
ServerSocket bound to a random unused port. |
static ServerSocket |
createServerSocket(ServerSocketFactory socketFactory)
Creates a new
ServerSocket bound to a random unused port. |
public ServerSocketUtil()
public static ServerSocket createServerSocket() throws IOException
ServerSocket
bound to a random unused port.
This method is a convenience overload for
createServerSocket(ServerSocketFactory)
using the platform's
default ServerSocketFactory
.
IOException
public static ServerSocket createServerSocket(ServerSocketFactory socketFactory) throws IOException
ServerSocket
bound to a random unused port.socketFactory
- socket factory that will be used to create the
socketIOException
Copyright © 2005–2018 QOS.ch. All rights reserved.