[enhancement] Add getter for Authenticated SOCKS server port by 2buisson · Pull Request #563 · bbottema/simple-java-mail
It is already possible to let the OS allocate an ephemeral port when starting the SOCKS proxy server with port = 0.
This very simple PR allows to retrieve the allocated port after the server is started by introducing a getter :
AnonymousSocks5Server s = new AnonymousSocks5ServerImpl(new AuthenticatingSocks5Bridge(socksProxyConfig), 0); // Get SOCKS server port int port = s.getLocalPort();
So it can be used in other projects.