public final class BoundSocketMaker extends Object implements Closeable
getPort()
. In
your test, then try to start a Server using same port to generate a BindException. Call
close()
when done to shut down the Socket.Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private ServerSocket |
socket |
Modifier | Constructor and Description |
---|---|
private |
BoundSocketMaker() |
|
BoundSocketMaker(String hostname,
Supplier<Integer> randomPortMaker) |
|
BoundSocketMaker(Supplier<Integer> randomPortMaker) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
private ServerSocket |
get(String hostname,
Supplier<Integer> randomPortMaker) |
int |
getPort() |
private static final org.slf4j.Logger LOG
private final ServerSocket socket
private BoundSocketMaker()
public BoundSocketMaker(Supplier<Integer> randomPortMaker)
public BoundSocketMaker(String hostname, Supplier<Integer> randomPortMaker)
public int getPort()
private ServerSocket get(String hostname, Supplier<Integer> randomPortMaker)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.