Energy harvesting (EH) from renewable energy sources is more environmental friendly and convenient than the conventional energy supplies. This paper considers a point-to-point channel with the transmitter powered by random energy harvester, for which the energy arrival process is stochastic, and the save-then-transmit scheme is adopted due to the battery half-duplex constraint: The transmitter first harvests energy for a certain time, and then stops EH to transmit information with all the accumulated energy at the battery. Obviously, it is crucial to determine a proper stopping time for EH, since larger EH duration provides more accumulated energy, while it may decrease the average throughput. In this paper, our goal is to compute the optimal stopping time to maximize the average throughput of the considered EH systems. First, considering the Gaussian channel scenario, this paper proves the existence of the optimal stopping rule and shows that this rule has a state-dependent "threshold-based" structure under the Markov energy arrival case. Then, for a special independent and identically distributed energy arrival case, this paper further proves that the corresponding stopping threshold is a constant, and can be efficiently computed by a proposed algorithm. Finally, this paper generalizes the above results to the fading channel scenario and obtains the corresponding optimal stopping rule, which can be computed by a recursive algorithm.