Package io.vertx.core

Examples of io.vertx.core.TimeoutStream


    await();
  }

  @Test
  public void testTimerStreamCancellation() throws Exception {
    TimeoutStream timer = vertx.timerStream(10);
    timer.handler(l -> {
      fail();
    });
    timer.endHandler(v -> {
      testComplete();
    });
    timer.cancel();
    await();
  }
View Full Code Here


    await();
  }

  @Test
  public void testTimeoutStreamEndCallbackAsynchronously1() {
    TimeoutStream stream = vertx.timerStream(10);
    ThreadLocal<Object> stack = new ThreadLocal<>();
    stack.set(true);
    stream.endHandler(v -> {
      assertTrue(vertx.context().isEventLoopContext());
      assertNull(stack.get());
      testComplete();
    });
    stream.handler(id -> {});
    await();
  }
View Full Code Here

  }

  // This test does not pass
  @Test
  public void testTimeoutStreamEndCallbackAsynchronously2() {
    TimeoutStream stream = vertx.periodicStream(10);
    ThreadLocal<Object> stack = new ThreadLocal<>();
    stream.endHandler(v -> {
      assertTrue(vertx.context().isEventLoopContext());
      assertNull(stack.get());
      testComplete();
    });
    stream.handler(id -> {
      stack.set(true);
      stream.cancel();
      stack.set(null);
    });
    await();
  }
View Full Code Here

TOP

Related Classes of io.vertx.core.TimeoutStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.