protected function validatePort(int $port = null): void
    {
        if ($port !== null && ($port < 1 || $port > 65535)) {
            throw new InvalidPort(
                sprintf(
                    'Invalid port "%d" specified; must be a valid TCP/UDP port',
                    $port
                )
            );
        }
    }