In the Internet today, traffic engineering is performed assuming that the offered traffic is inelastic. In reality, end hosts adapt their sending rates to network congestion, and network operators adapt the routing to the measured traffic. This raises the question of whether the joint system of congestion control and routing is stable and optimal. Using established optimization models for TCP and traffic engineering as a basis, we find the joint system is stable and typically maximizes aggregate user utility through simulation. The joint system may deviate from this solution when the topology is not uniform. A modification to the joint system will guarantee stability and optimality for applications that are sufficiently elastic, but at the cost of robustness.