Throw IAE if invalid port number is given for Socks5Proxy

This commit is contained in:
Florian Schmaus 2014-08-05 09:33:20 +02:00
parent 5c2f051c1c
commit 4e588f7908
1 changed files with 3 additions and 0 deletions

View File

@ -147,6 +147,9 @@ public class Socks5Proxy {
* @param localSocks5ProxyPort the port of the local Socks5 proxy to set
*/
public static void setLocalSocks5ProxyPort(int localSocks5ProxyPort) {
if (Math.abs(localSocks5ProxyPort) > 65535) {
throw new IllegalArgumentException("localSocks5ProxyPort must be within (-65535,65535)");
}
Socks5Proxy.localSocks5ProxyPort = localSocks5ProxyPort;
}