Replace setReadTimeout with wait.