Allow reconnect if the connection was closed.
Fix tests after subprocess.call was replaced with os.execvp.
Update to new get_masters interface.