simplify port binding logic
support SSL