In a context in which the connectivity level of last-generation vehicles is constantly on the rise, the combined use of Vehicle-To-Everything (V2X) connectivity and autonomous driving can provide remarkable benefits through the synergistic optimization of the route and the speed trajectory. In this framework, this paper focuses on vehicle ecodriving optimization in a connected environment: the virtual test rig of a premium segment passenger car was used for generating the simulation scenarios and to assess the benefits, in terms of energy and time savings, that the introduction of V2X communication, integrated with cloud computing, can have in a real-world scenario. The Reference Scenario is a predefined Real Driving Emissions (RDE) compliant route, while the simulation scenarios were generated by assuming two different penetration levels of V2X technologies. The associated energy minimization problem was formulated and solved by means of a Variable Grid Dynamic Programming (VGDP), that modifying the variable state search grid on the basis of the V2X information allows to drastically reduce the DP computation burden by more than 95%. The simulations show that introducing a smart infrastructure along with optimizing the vehicle speed in a real-world urban route can potentially reduce the required energy by 54% while shortening the travel time by 38%. Finally, a sensitivity analysis was performed on the biobjective optimization cost function to find a set of Pareto optimal solutions, between energy and travel time minimization.