@Override
        public Response send(Request req, String home, String method,
            Collection<Entry<String, String>> headers, InputStream content, int connect, int read)
            throws IOException {
            int attempt = 0;
            while (true) {
                if (attempt > 3) {
                    throw new IOException(
                        String.format("Failed after %d attempts", attempt)
                    );
                }
                try {
                    return this.origin.send(
                        req, home, method, headers, content, connect, read
                    );
                } catch (final IOException ex) {
                    System.out.println("An IO issue occurred. Will try again momentarily: " + ex.getMessage());
                    ex.printStackTrace();
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
                ++attempt;
            }
        }
Retry if unable to connect (used by jcabi, needs to be public as they use reflection magic).
test/common/src/main/java/io/apiman/test/common/util/TestPlanRunner.java