adds a test for port binding behavior, fixes #331