Use high-level stream APIs and implemented reconnection.