Connected Autonomous Vehicles: Capacity Analysis, Trajectory Optimization, and Speed Harmonization