public class Socks5DatagramSocket extends DatagramSocket
Socks5DatagramSocket
is a DatagramSocket that support SOCKS5 proxy.SocksProxy proxy = new Socks5(new InetSocketAddress("foo.com", 1080)); // Setting proxy... DatagramSocket client = new Socks5DatagramSocket(proxy); // Just use it as normal java.net.DatagramSocket now.
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
logger
logger that subclasses also can use.
|
Constructor and Description |
---|
Socks5DatagramSocket(SocksProxy proxy)
Constructs a datagram socket with a
SocksProxy . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
SocksProxy |
getProxy() |
void |
receive(DatagramPacket packet) |
void |
send(DatagramPacket packet) |
void |
setProxy(SocksProxy proxy) |
bind, connect, connect, disconnect, getBroadcast, getChannel, getInetAddress, getLocalAddress, getLocalPort, getLocalSocketAddress, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoTimeout, getTrafficClass, isBound, isClosed, isConnected, setBroadcast, setDatagramSocketImplFactory, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoTimeout, setTrafficClass
protected static final org.slf4j.Logger logger
public Socks5DatagramSocket(SocksProxy proxy) throws SocksException, IOException
SocksProxy
. Socks5
, because only SOCKS5 protocol supports UDP
ASSOCIATE. It will throw SocksException
if you give other SocksProxy
implementation which not supports SOCKS5 protocol.proxy
- Socks5
instance.SocksException
- If any error about SOCKS protocol occurs.IOException
- If any I/O error occurs.public void send(DatagramPacket packet) throws SocksException, IOException
send
in class DatagramSocket
SocksException
IOException
public void receive(DatagramPacket packet) throws SocksException, IOException
receive
in class DatagramSocket
SocksException
IOException
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class DatagramSocket
public SocksProxy getProxy()
public void setProxy(SocksProxy proxy)
Copyright © 2015. All rights reserved.