Anaerobic wastewater treatment for energy recovery and water reclamation