From 5c2f051c1ce6d4a4e1ac3529ea984f20018347c1 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 5 Aug 2014 09:32:13 +0200 Subject: [PATCH] Make Socks5Proxy try other ports if 7777 is already in use by setting the default value to '-7777' (negative values mean that the next port number will be tried if the current one is in use). --- .../smackx/bytestreams/socks5/Socks5Proxy.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java index 08a0abfff..1728347aa 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java @@ -73,7 +73,12 @@ public class Socks5Proxy { private static Socks5Proxy socks5Server; private static boolean localSocks5ProxyEnabled = true; - private static int localSocks5ProxyPort = 7777; + + /** + * The port of the local Socks5 Proxy. If this value is negative, the next ports will be tried + * until a unused is found. + */ + private static int localSocks5ProxyPort = -7777; /* reusable implementation of a SOCKS5 proxy server process */ private Socks5ServerProcess serverProcess;