@Test public void testInterrupting() throws Exception { TusExecutor exec = new TusExecutor() { @Override protected void makeAttempt() throws ProtocolException, IOException { throw new IOException(); } }; exec.setDelays(new int[]{100000}); final Thread executorThread = Thread.currentThread(); Thread waiterThread = new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(100); executorThread.interrupt(); } catch(InterruptedException e) { e.printStackTrace(); } } }); waiterThread.start(); assertFalse(exec.makeAttempts()); }
executor.makeAttempts(); } catch(Exception e) { e.printStackTrace();