Generalizes simple_client a little.