DefaultFuture extends CompletableFuture<Object> { public static DefaultFuture newFuture(Channel channel, Request request, int timeout, ExecutorService executor) { final DefaultFuture future = new DefaultFuture(channel, request, timeout); future.setExecutor(executor); if (executor instanceof ThreadlessExecutor) { ((ThreadlessExecutor) executor).setWaitingFuture(future); } timeoutCheck(future); return future; } private  DefaultFuture(Channel channel, Request request, int timeout); ExecutorService getExecutor(); void setExecutor(ExecutorService executor); static DefaultFuture newFuture(Channel channel, Request request, int timeout, ExecutorService executor); static DefaultFuture getFuture(long id); static boolean hasFuture(Channel channel); static void sent(Channel channel, Request request); static void closeChannel(Channel channel); static void received(Channel channel, Response response); static void received(Channel channel, Response response, boolean timeout); @Override boolean cancel(boolean mayInterruptIfRunning); void cancel(); Request getRequest(); static final Timer TIME_OUT_TIMER; }
@Test public void newFuture() { DefaultFuture future = defaultFuture(3000); Assertions.assertNotNull(future, "new future return null"); }