@Override
    public <T extends Recorder> RetryContext<T> context() {
        return new RetryContextImpl<>();
    }
@Test
    public void contextTest() throws Exception {
        final Retry retry = Retry.create(build("context", false));
        final RetryContext<Recorder> context = retry.context();
        final Recorder recorder = Mockito.mock(Recorder.class);
        context.onBefore(recorder);
        Mockito.verify(recorder, Mockito.times(1)).beforeRequest();
        long consumeTimeMs = 100L;
        final IOException ioError = new ConnectException("io error");
        context.onError(recorder, ioError, consumeTimeMs);
        Mockito.verify(recorder, Mockito.times(1)).errorRequest(ioError, consumeTimeMs);
        boolean isRight = false;
        try {
            context.onError(recorder, new IllegalArgumentException("error"), consumeTimeMs);
        } catch (RetryException ex) {
            isRight = true;
        }
        Assert.assertTrue(isRight);
        final boolean result = context.onResult(recorder, new Object(), consumeTimeMs);
        Assert.assertFalse(result);
        Mockito.verify(recorder, Mockito.times(1)).afterRequest(consumeTimeMs);
        context.onComplete(recorder);
        Mockito.verify(recorder, Mockito.times(1)).completeRequest();
    }