Properly destroy assignRegistry singleton at end of test
Added an additional check whether the forwardingPort is valid