public class DelegatingServerSocket extends ServerSocket
ServerSocket
which delegates (its method calls) to
another ServerSocket
. In other words, the former wraps the latter.Modifier and Type | Field and Description |
---|---|
protected ServerSocketChannel |
channel
The
ServerSocketChannel of this instance. |
protected ServerSocket |
delegate
The
ServerSocket this instance delegates (its method calls) to. |
Constructor and Description |
---|
DelegatingServerSocket(ServerSocket delegate)
Initializes a new
DelegatingServerSocket instance which is to
delegate (its method calls) to a specific ServerSocket . |
DelegatingServerSocket(ServerSocket delegate,
ServerSocketChannel channel)
Initializes a new
DelegatingServerSocket instance which is to
delegate (its method calls) to a specific ServerSocket and is to
report a specific ServerSocketChannel . |
Modifier and Type | Method and Description |
---|---|
Socket |
accept()
Forwards to
delegate . |
void |
bind(SocketAddress endpoint)
Forwards to
delegate . |
void |
bind(SocketAddress endpoint,
int backlog)
Forwards to
delegate . |
void |
close()
Forwards to
delegate . |
ServerSocketChannel |
getChannel()
If
channel is not null , returns it. |
InetAddress |
getInetAddress()
Forwards to
delegate . |
int |
getLocalPort()
Forwards to
delegate . |
SocketAddress |
getLocalSocketAddress()
Forwards to
delegate . |
int |
getReceiveBufferSize()
Forwards to
delegate . |
boolean |
getReuseAddress()
Forwards to
delegate . |
int |
getSoTimeout()
Forwards to
delegate . |
boolean |
isBound()
Forwards to
delegate . |
boolean |
isClosed()
Forwards to
delegate . |
void |
setPerformancePreferences(int connectionTime,
int latency,
int bandwidth)
Forwards to
delegate . |
void |
setReceiveBufferSize(int size)
Forwards to
delegate . |
void |
setReuseAddress(boolean on)
Forwards to
delegate . |
void |
setSoTimeout(int timeout)
Forwards to
delegate . |
String |
toString()
Forwards to
delegate . |
implAccept, setSocketFactory
protected final ServerSocketChannel channel
protected final ServerSocket delegate
ServerSocket
this instance delegates (its method calls) to.public DelegatingServerSocket(ServerSocket delegate) throws IOException
DelegatingServerSocket
instance which is to
delegate (its method calls) to a specific ServerSocket
.delegate
- the ServerSocket
the new instance is to delegate
(it method calls) toIOException
- never thrownpublic DelegatingServerSocket(ServerSocket delegate, ServerSocketChannel channel) throws IOException
DelegatingServerSocket
instance which is to
delegate (its method calls) to a specific ServerSocket
and is to
report a specific ServerSocketChannel
.delegate
- the ServerSocket
the new instance is to delegate
(it method calls) tochannel
- the ServerSocketChannel
to be reported by the new
instance or null
to report the one of delegate
IOException
- never thrownpublic Socket accept() throws IOException
delegate
.accept
in class ServerSocket
IOException
public void bind(SocketAddress endpoint) throws IOException
delegate
.bind
in class ServerSocket
IOException
public void bind(SocketAddress endpoint, int backlog) throws IOException
delegate
.bind
in class ServerSocket
IOException
public void close() throws IOException
delegate
.close
in interface Closeable
close
in interface AutoCloseable
close
in class ServerSocket
IOException
public ServerSocketChannel getChannel()
getChannel
in class ServerSocket
public InetAddress getInetAddress()
delegate
.getInetAddress
in class ServerSocket
public int getLocalPort()
delegate
.getLocalPort
in class ServerSocket
public SocketAddress getLocalSocketAddress()
delegate
.getLocalSocketAddress
in class ServerSocket
public int getReceiveBufferSize() throws SocketException
delegate
.getReceiveBufferSize
in class ServerSocket
SocketException
public boolean getReuseAddress() throws SocketException
delegate
.getReuseAddress
in class ServerSocket
SocketException
public int getSoTimeout() throws IOException
delegate
.getSoTimeout
in class ServerSocket
IOException
public boolean isBound()
delegate
.isBound
in class ServerSocket
public boolean isClosed()
delegate
.isClosed
in class ServerSocket
public void setPerformancePreferences(int connectionTime, int latency, int bandwidth)
delegate
.setPerformancePreferences
in class ServerSocket
public void setReceiveBufferSize(int size) throws SocketException
delegate
.setReceiveBufferSize
in class ServerSocket
SocketException
public void setReuseAddress(boolean on) throws SocketException
delegate
.setReuseAddress
in class ServerSocket
SocketException
public void setSoTimeout(int timeout) throws SocketException
delegate
.setSoTimeout
in class ServerSocket
SocketException
public String toString()
delegate
.toString
in class ServerSocket
Copyright © 2018. All rights reserved.