Update Java API to support the new wait APIs.

R=ppi@chromium.org

Review URL: https://codereview.chromium.org/807113002