Index: source/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java =================================================================== --- source/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java (revision 6340) +++ source/org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java (working copy) @@ -140,7 +140,21 @@ } } else { - this.serverSocket = new ServerSocket(SmackConfiguration.getLocalSocks5ProxyPort()); + boolean isSetUp = false; + int port = Math.abs(SmackConfiguration.getLocalSocks5ProxyPort()); + for (int i = 0; i < 65535 - port; i++) { + try { + this.serverSocket = new ServerSocket(port + i); + isSetUp = true; + break; + } + catch (IOException e) { + // port is used, try next one + } + } + if (!isSetUp){ + throw new IOException("Address already in use: JVM_Bind"); + } } if (this.serverSocket != null) {