Service

1. Refactor the findPort function: clearly separate the finding logic for int type and string type

2. Refactor the findPort test: use table driven test approach

You are right. I was following the original logic. I was not sure if the shortcut worths the effort. 

I will add a test to catch the the worse case and fix it in the implementation.  

Sounds good?