@TokaraForest
I don't see that it will make any difference whether you stick with asynchronous approach (which does not block) in UI thread or use synchronous approach with waitFor...() in a thread (which will block that thread but not the Ui thread). Either way scanning 100 ports will take some time because each port has to have time to timeout. It will be "slow". You might as well use asynchronous and not get involved with threads if this is what you have to do.
But why do you want to scan ports, and at which side? Client should be able to be set to use any available port to connect to server (this is fast). And server needs to specify which port it will be listening on, there is no point it finding a free one as client will not know which one it picked to connect on.