Refactor protos.utility.checkPort