Class SocketAdapter
java.lang.Object
java.net.Socket
com.comphenix.protocol.injector.netty.SocketAdapter
- All Implemented Interfaces:
Closeable,AutoCloseable
This class wraps a Netty
Channel in a Socket. It overrides
all methods in Socket to ensure that calls are not mistakingly made
to the unsupported super socket. All operations that can be sanely applied to
a Channel are implemented here. Those which cannot will throw an
UnsupportedOperationException.-
Method Summary
Modifier and TypeMethodDescriptionstatic SocketAdapteradapt(io.netty.channel.Channel ch)voidbind(SocketAddress bindpoint)voidclose()voidconnect(SocketAddress endpoint)voidconnect(SocketAddress endpoint, int timeout)booleanbooleanintbooleanintgetPort()intbooleanintintintbooleanintinthashCode()booleanisBound()booleanisClosed()booleanbooleanbooleanvoidsendUrgentData(int data)voidsetKeepAlive(boolean on)voidsetOOBInline(boolean on)voidsetPerformancePreferences(int connectionTime, int latency, int bandwidth)voidsetReceiveBufferSize(int size)voidsetReuseAddress(boolean on)voidsetSendBufferSize(int size)voidsetSoLinger(boolean on, int linger)voidsetSoTimeout(int timeout)voidsetTcpNoDelay(boolean on)voidsetTrafficClass(int tc)voidvoidtoString()Methods inherited from class java.net.Socket
getOption, setOption, setSocketImplFactory, supportedOptions
-
Method Details
-
adapt
-
bind
- Overrides:
bindin classSocket- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classSocket- Throws:
IOException
-
connect
- Overrides:
connectin classSocket- Throws:
IOException
-
connect
- Overrides:
connectin classSocket- Throws:
IOException
-
equals
-
getChannel
- Overrides:
getChannelin classSocket
-
getInetAddress
- Overrides:
getInetAddressin classSocket
-
getInputStream
- Overrides:
getInputStreamin classSocket- Throws:
IOException
-
getKeepAlive
- Overrides:
getKeepAlivein classSocket- Throws:
SocketException
-
getLocalAddress
- Overrides:
getLocalAddressin classSocket
-
getLocalPort
public int getLocalPort()- Overrides:
getLocalPortin classSocket
-
getLocalSocketAddress
- Overrides:
getLocalSocketAddressin classSocket
-
getOOBInline
- Overrides:
getOOBInlinein classSocket- Throws:
SocketException
-
getOutputStream
- Overrides:
getOutputStreamin classSocket- Throws:
IOException
-
getPort
public int getPort() -
getReceiveBufferSize
- Overrides:
getReceiveBufferSizein classSocket- Throws:
SocketException
-
getRemoteSocketAddress
- Overrides:
getRemoteSocketAddressin classSocket
-
getReuseAddress
- Overrides:
getReuseAddressin classSocket- Throws:
SocketException
-
getSendBufferSize
- Overrides:
getSendBufferSizein classSocket- Throws:
SocketException
-
getSoLinger
- Overrides:
getSoLingerin classSocket- Throws:
SocketException
-
getSoTimeout
- Overrides:
getSoTimeoutin classSocket- Throws:
SocketException
-
getTcpNoDelay
- Overrides:
getTcpNoDelayin classSocket- Throws:
SocketException
-
getTrafficClass
- Overrides:
getTrafficClassin classSocket- Throws:
SocketException
-
hashCode
public int hashCode() -
isBound
public boolean isBound() -
isClosed
public boolean isClosed() -
isConnected
public boolean isConnected()- Overrides:
isConnectedin classSocket
-
isInputShutdown
public boolean isInputShutdown()- Overrides:
isInputShutdownin classSocket
-
isOutputShutdown
public boolean isOutputShutdown()- Overrides:
isOutputShutdownin classSocket
-
sendUrgentData
- Overrides:
sendUrgentDatain classSocket- Throws:
IOException
-
setKeepAlive
- Overrides:
setKeepAlivein classSocket- Throws:
SocketException
-
setOOBInline
- Overrides:
setOOBInlinein classSocket- Throws:
SocketException
-
setPerformancePreferences
public void setPerformancePreferences(int connectionTime, int latency, int bandwidth)- Overrides:
setPerformancePreferencesin classSocket
-
setReceiveBufferSize
- Overrides:
setReceiveBufferSizein classSocket- Throws:
SocketException
-
setReuseAddress
- Overrides:
setReuseAddressin classSocket- Throws:
SocketException
-
setSendBufferSize
- Overrides:
setSendBufferSizein classSocket- Throws:
SocketException
-
setSoLinger
- Overrides:
setSoLingerin classSocket- Throws:
SocketException
-
setSoTimeout
- Overrides:
setSoTimeoutin classSocket- Throws:
SocketException
-
setTcpNoDelay
- Overrides:
setTcpNoDelayin classSocket- Throws:
SocketException
-
setTrafficClass
- Overrides:
setTrafficClassin classSocket- Throws:
SocketException
-
shutdownInput
- Overrides:
shutdownInputin classSocket- Throws:
IOException
-
shutdownOutput
- Overrides:
shutdownOutputin classSocket- Throws:
IOException
-
toString
-