This paper addresses the problem of joint inference and optimization in wireless networks. An optimization framework based on information-geometric network inference is developed and implemented (using a real radio emulation testbed) with scalable solutions to infer the end-to-end rate distributions of stochastic network flows from link rate measurements. The proposed low-complexity solutions apply when the underlying network inference (network tomography) problem can be decomposed to smaller-size subproblems that are solved independently by partially inferring only the flow rates of interest. The solutions are extended to infer flow rates jointly with link loss rates when retransmissions are considered over unreliable wireless links. By using the inferred distributions of flow rates, an inference mechanism is presented to optimize the network performance. First, the distributions of flow rates are inferred from the average rate measurements on selected links. Then, the distributions of all links rates are computed from the inferred distributions of flow rates. Finally, these inference results are used with network optimization. The weighted sum of link outage probabilities is minimized by adapting power control or routing decisions in mobile wireless access. This approach is iterated between network inference and optimization, providing link outage and end-to-end throughput gains compared to static approaches with fixed network (inference and optimization) parameters. The joint network inference and optimization framework is implemented with real configurable radios and the performance is verified with hardware-in-the-loop emulation test results that are obtained with actual radio transmissions over emulated channels.