Open and close the stubbed port when appropriate