Class Socks5BytestreamRequest
- All Implemented Interfaces:
BytestreamRequest
-
Constructor Summary
ModifierConstructorDescriptionprotected
Socks5BytestreamRequest
(Socks5BytestreamManager manager, Bytestream bytestreamRequest) Creates a new Socks5BytestreamRequest. -
Method Summary
Modifier and TypeMethodDescriptionaccept()
Accepts the SOCKS5 Bytestream initialization request and returns the socket to send/receive data.int
Returns the number of connection failures it takes for a particular SOCKS5 proxy to be blacklisted.static int
Returns the default connection failure threshold.getFrom()
Returns the sender of the SOCKS5 Bytestream initialization request.int
Returns the timeout to connect to one SOCKS5 proxy while accepting the SOCKS5 Bytestream request.Returns the session ID of the SOCKS5 Bytestream initialization request.int
Returns the maximum timeout to connect to SOCKS5 proxies.void
reject()
Rejects the SOCKS5 Bytestream request by sending a reject error to the initiator.void
setConnectFailureThreshold
(int connectFailureThreshold) Sets the number of connection failures it takes for a particular SOCKS5 proxy to be blacklisted.static void
setDefaultConnectFailureThreshold
(int defaultConnectFailureThreshold) Sets the default connection failure threshold.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.
-
Constructor Details
-
Socks5BytestreamRequest
Creates a new Socks5BytestreamRequest.- Parameters:
manager
- the SOCKS5 Bytestream managerbytestreamRequest
- the SOCKS5 Bytestream initialization packet
-
-
Method Details
-
getDefaultConnectFailureThreshold
Returns the default connection failure threshold.- Returns:
- the default connection failure threshold.
- Since:
- 4.4.0
- See Also:
-
setDefaultConnectFailureThreshold
Sets the default connection failure threshold.- Parameters:
defaultConnectFailureThreshold
- the default connection failure threshold.- Since:
- 4.4.0
- See Also:
-
getConnectFailureThreshold
Returns the number of connection failures it takes for a particular SOCKS5 proxy to be blacklisted. When a proxy is blacklisted no more connection attempts will be made to it for a period of 2 hours. Default is 2.- Returns:
- the number of connection failures it takes for a particular SOCKS5 proxy to be blacklisted
-
setConnectFailureThreshold
Sets the number of connection failures it takes for a particular SOCKS5 proxy to be blacklisted. When a proxy is blacklisted no more connection attempts will be made to it for a period of 2 hours. Default is 2.Setting the connection failure threshold to zero disables the blacklisting.
- Parameters:
connectFailureThreshold
- the number of connection failures it takes for a particular SOCKS5 proxy to be blacklisted
-
getTotalConnectTimeout
Returns the maximum timeout to connect to SOCKS5 proxies. Default is 10000ms.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)
.- Returns:
- the maximum timeout to connect to SOCKS5 proxies
-
setTotalConnectTimeout
Sets the maximum timeout to connect to SOCKS5 proxies. Default is 10000ms.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)
.- Parameters:
totalConnectTimeout
- the maximum timeout to connect to SOCKS5 proxies
-
getMinimumConnectTimeout
Returns the timeout to connect to one SOCKS5 proxy while accepting the SOCKS5 Bytestream request. Default is 2000ms.- Returns:
- the timeout to connect to one SOCKS5 proxy
-
setMinimumConnectTimeout
Sets the timeout to connect to one SOCKS5 proxy while accepting the SOCKS5 Bytestream request. Default is 2000ms.- Parameters:
minimumConnectTimeout
- the timeout to connect to one SOCKS5 proxy
-
getFrom
Returns the sender of the SOCKS5 Bytestream initialization request.- Specified by:
getFrom
in interfaceBytestreamRequest
- Returns:
- the sender of the SOCKS5 Bytestream initialization request.
-
getSessionID
Returns the session ID of the SOCKS5 Bytestream initialization request.- Specified by:
getSessionID
in interfaceBytestreamRequest
- Returns:
- the session ID of the SOCKS5 Bytestream initialization request.
-
accept
public Socks5BytestreamSession accept() throws InterruptedException, XMPPException.XMPPErrorException, Socks5Exception.CouldNotConnectToAnyProvidedSocks5Host, SmackException.NotConnectedException, Socks5Exception.NoSocks5StreamHostsProvidedAccepts the SOCKS5 Bytestream initialization request and returns the socket to send/receive data.Before accepting the SOCKS5 Bytestream request you can set timeouts by invoking
setTotalConnectTimeout(int)
andsetMinimumConnectTimeout(int)
.- Specified by:
accept
in interfaceBytestreamRequest
- Returns:
- the socket to send/receive data
- Throws:
InterruptedException
- if the current thread was interrupted while waitingXMPPException.XMPPErrorException
- if there was an XMPP error returned.SmackException.NotConnectedException
- if the XMPP connection is not connected.Socks5Exception.CouldNotConnectToAnyProvidedSocks5Host
- if no connection to any provided stream host could be establishedSocks5Exception.NoSocks5StreamHostsProvided
- if no stream host was provided.
-
reject
Rejects the SOCKS5 Bytestream request by sending a reject error to the initiator.- Specified by:
reject
in interfaceBytestreamRequest
- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-