This paper provides a general framework for utility maximization of a wireless network with energy harvesting nodes. The focus is on applying this framework to the single-link problem with an energy harvesting transmitter and an energy harvesting receiver. For the general utility maximization problem, it is shown that if the utility of a network can be expressed instantaneously as a function of the powers of the nodes, then the maximum utility achieving power policy for each node can be found using a water-filling approach for each user. This is achieved by expressing the general utility maximization problem as a pair of nested problems focusing on energy efficiency and adapting to energy harvests separately. The framework extends the previous results on offline optimization of energy harvesting transmitters to networks with all energy harvesting nodes including receivers and relays as well as any network utility, provided that the achieved utility is instantaneous and additive in time. The implications of the energy efficiency problem on the energy harvesting problem are demonstrated over an energy harvesting transmitter-receiver pair, and simulation results are presented to exhibit the performance of the optimal policy along with some alternatives for a range of storage capacities.