public class Socks5BytestreamRequest extends java.lang.Object implements BytestreamRequest
Modifier | Constructor and Description |
---|---|
protected |
Socks5BytestreamRequest(Socks5BytestreamManager manager,
Bytestream bytestreamRequest)
Creates a new Socks5BytestreamRequest.
|
Modifier and Type | Method and Description |
---|---|
Socks5BytestreamSession |
accept()
Accepts the SOCKS5 Bytestream initialization request and returns the socket to send/receive
data.
|
static int |
getConnectFailureThreshold()
Returns the number of connection failures it takes for a particular SOCKS5 proxy to be
blacklisted.
|
java.lang.String |
getFrom()
Returns the sender of the SOCKS5 Bytestream initialization request.
|
int |
getMinimumConnectTimeout()
Returns the timeout to connect to one SOCKS5 proxy while accepting the SOCKS5 Bytestream
request.
|
java.lang.String |
getSessionID()
Returns the session ID of the SOCKS5 Bytestream initialization request.
|
int |
getTotalConnectTimeout()
Returns the maximum timeout to connect to SOCKS5 proxies.
|
void |
reject()
Rejects the SOCKS5 Bytestream request by sending a reject error to the initiator.
|
static void |
setConnectFailureThreshold(int connectFailureThreshold)
Sets the number of connection failures it takes for a particular SOCKS5 proxy to be
blacklisted.
|
void |
setMinimumConnectTimeout(int minimumConnectTimeout)
Sets the timeout to connect to one SOCKS5 proxy while accepting the SOCKS5 Bytestream
request.
|
void |
setTotalConnectTimeout(int totalConnectTimeout)
Sets the maximum timeout to connect to SOCKS5 proxies.
|
protected Socks5BytestreamRequest(Socks5BytestreamManager manager, Bytestream bytestreamRequest)
manager
- the SOCKS5 Bytestream managerbytestreamRequest
- the SOCKS5 Bytestream initialization packetpublic static int getConnectFailureThreshold()
public static void setConnectFailureThreshold(int connectFailureThreshold)
Setting the connection failure threshold to zero disables the blacklisting.
connectFailureThreshold
- the number of connection failures it takes for a particular
SOCKS5 proxy to be blacklistedpublic int getTotalConnectTimeout()
When accepting a SOCKS5 Bytestream request Smack tries to connect to all SOCKS5 proxies given by the initiator until a connection is established. This timeout divided by the number of SOCKS5 proxies determines the timeout for every connection attempt.
You can set the minimum timeout for establishing a connection to one SOCKS5 proxy by invoking
setMinimumConnectTimeout(int)
.
public void setTotalConnectTimeout(int totalConnectTimeout)
When accepting a SOCKS5 Bytestream request Smack tries to connect to all SOCKS5 proxies given by the initiator until a connection is established. This timeout divided by the number of SOCKS5 proxies determines the timeout for every connection attempt.
You can set the minimum timeout for establishing a connection to one SOCKS5 proxy by invoking
setMinimumConnectTimeout(int)
.
totalConnectTimeout
- the maximum timeout to connect to SOCKS5 proxiespublic int getMinimumConnectTimeout()
public void setMinimumConnectTimeout(int minimumConnectTimeout)
minimumConnectTimeout
- the timeout to connect to one SOCKS5 proxypublic java.lang.String getFrom()
getFrom
in interface BytestreamRequest
public java.lang.String getSessionID()
getSessionID
in interface BytestreamRequest
public Socks5BytestreamSession accept() throws java.lang.InterruptedException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException
Before accepting the SOCKS5 Bytestream request you can set timeouts by invoking
setTotalConnectTimeout(int)
and setMinimumConnectTimeout(int)
.
accept
in interface BytestreamRequest
java.lang.InterruptedException
- if the current thread was interrupted while waitingorg.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException
org.jivesoftware.smack.SmackException.NoResponseException
public void reject() throws org.jivesoftware.smack.SmackException.NotConnectedException
reject
in interface BytestreamRequest
org.jivesoftware.smack.SmackException.NotConnectedException