-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public class DelegatingServerSocket extends ServerSocket
Implements a
ServerSocketwhich delegates (its method calls) to anotherServerSocket. In other words, the former wraps the latter.
-
-
Field Summary
Fields Modifier and Type Field Description protected final ServerSocketChannelchannel
-
Constructor Summary
Constructors Constructor Description DelegatingServerSocket(ServerSocket delegate)Initializes a new DelegatingServerSocketinstance which is to delegate (its method calls) to a specific ServerSocket.DelegatingServerSocket(ServerSocket delegate, ServerSocketChannel channel)Initializes a new DelegatingServerSocketinstance which is to delegate (its method calls) to a specific ServerSocket and is to report a specific ServerSocketChannel.
-
Method Summary
Modifier and Type Method Description ServerSocketChannelgetChannel()If channel is not null, returns it.Socketaccept()Forwards to delegate. voidbind(SocketAddress endpoint)Forwards to delegate. voidbind(SocketAddress endpoint, int backlog)Forwards to delegate. voidclose()Forwards to delegate. InetAddressgetInetAddress()Forwards to delegate. intgetLocalPort()Forwards to delegate. SocketAddressgetLocalSocketAddress()Forwards to delegate. intgetReceiveBufferSize()Forwards to delegate. booleangetReuseAddress()Forwards to delegate. intgetSoTimeout()Forwards to delegate. booleanisBound()Forwards to delegate. booleanisClosed()Forwards to delegate. voidsetPerformancePreferences(int connectionTime, int latency, int bandwidth)Forwards to delegate. voidsetReceiveBufferSize(int size)Forwards to delegate. voidsetReuseAddress(boolean on)Forwards to delegate. voidsetSoTimeout(int timeout)Forwards to delegate. StringtoString()Forwards to delegate. -
-
Constructor Detail
-
DelegatingServerSocket
DelegatingServerSocket(ServerSocket delegate)
Initializes a newDelegatingServerSocketinstance which is to delegate (its method calls) to a specific ServerSocket.- Parameters:
delegate- theServerSocketthe new instance is to delegate (it method calls) to
-
DelegatingServerSocket
DelegatingServerSocket(ServerSocket delegate, ServerSocketChannel channel)
Initializes a newDelegatingServerSocketinstance which is to delegate (its method calls) to a specific ServerSocket and is to report a specific ServerSocketChannel.- Parameters:
delegate- theServerSocketthe new instance is to delegate (it method calls) tochannel- theServerSocketChannelto be reported by the new instance ornullto report the one ofdelegate
-
-
Method Detail
-
getChannel
ServerSocketChannel getChannel()
If channel is not
null, returns it. Otherwise, forwards to delegate.
-
bind
void bind(SocketAddress endpoint)
Forwards to delegate.
-
bind
void bind(SocketAddress endpoint, int backlog)
Forwards to delegate.
-
close
void close()
Forwards to delegate.
-
getInetAddress
InetAddress getInetAddress()
Forwards to delegate.
-
getLocalPort
int getLocalPort()
Forwards to delegate.
-
getLocalSocketAddress
SocketAddress getLocalSocketAddress()
Forwards to delegate.
-
getReceiveBufferSize
int getReceiveBufferSize()
Forwards to delegate.
-
getReuseAddress
boolean getReuseAddress()
Forwards to delegate.
-
getSoTimeout
int getSoTimeout()
Forwards to delegate.
-
isBound
boolean isBound()
Forwards to delegate.
-
isClosed
boolean isClosed()
Forwards to delegate.
-
setPerformancePreferences
void setPerformancePreferences(int connectionTime, int latency, int bandwidth)
Forwards to delegate.
-
setReceiveBufferSize
void setReceiveBufferSize(int size)
Forwards to delegate.
-
setReuseAddress
void setReuseAddress(boolean on)
Forwards to delegate.
-
setSoTimeout
void setSoTimeout(int timeout)
Forwards to delegate.
-
-
-
-