FreeSilverProtocol { public GetSilverInfo waitToGetSilver() throws BiliLiveException, InterruptedException { return waitToGetSilver(getCurrentFreeSilverStatus()); } FreeSilverProtocol(Session session); @NotNull static String ocrCaptcha(BufferedImage image); CurrentSilverTaskInfo getCurrentFreeSilverStatus(); DayFreeSilverTaskInfo getTodayFreeSilverStatus(); BufferedImage getCaptcha(); GetSilverInfo waitToGetSilver(); GetSilverInfo waitToGetSilver(CurrentSilverTaskInfo currentInfo); GetSilverInfo getSilver(long timeStart, long timeEnd, String captcha);  }
@Test public void waitToGetSilver() throws Exception { FreeSilverProtocol protocol = new FreeSilverProtocol(initSession()); FreeSilverProtocol.CurrentSilverTaskInfo taskInfo = protocol.getCurrentFreeSilverStatus(); if (!taskInfo.hasRemaining()) fail(); FreeSilverProtocol.GetSilverInfo info = null; do { try { info = protocol.waitToGetSilver(); System.out.println(info); } catch (Exception e) { e.printStackTrace(); } } while (info == null || !info.isEnd()); }