Examples of endHandler()


Examples of io.vertx.core.TimeoutStream.endHandler()

  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

Examples of io.vertx.core.TimeoutStream.endHandler()

  @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 -> {});
View Full Code Here

Examples of io.vertx.core.TimeoutStream.endHandler()

  // 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 -> {
View Full Code Here

Examples of io.vertx.core.file.AsyncFile.endHandler()

        AsyncFile rs = ar.result();
        rs.setReadPos(chunkSize * chunks / 2);
        Buffer buff = Buffer.buffer();
        rs.handler(buff::appendBuffer);
        rs.exceptionHandler(t -> fail(t.getMessage()));
        rs.endHandler(v -> {
          ar.result().close(ar2 -> {
            if (ar2.failed()) {
              fail(ar2.cause().getMessage());
            } else {
              assertEquals(chunkSize * chunks / 2, buff.length());
View Full Code Here

Examples of io.vertx.core.http.HttpServerRequestStream.endHandler()

    AtomicInteger done = new AtomicInteger();
    HttpServerRequestStream stream = server.requestStream();
    stream.handler(req -> {});
    ThreadLocal<Object> stack = new ThreadLocal<>();
    stack.set(true);
    stream.endHandler(v -> {
      assertTrue(vertx.context().isEventLoopContext());
      assertNull(stack.get());
      if (done.incrementAndGet() == 2) {
        testComplete();
      }
View Full Code Here

Examples of io.vertx.core.http.ServerWebSocketStream.endHandler()

    AtomicInteger done = new AtomicInteger();
    ServerWebSocketStream stream = server.websocketStream();
    stream.handler(req -> { });
    ThreadLocal<Object> stack = new ThreadLocal<>();
    stack.set(true);
    stream.endHandler(v -> {
      assertTrue(vertx.context().isEventLoopContext());
      assertNull(stack.get());
      if (done.incrementAndGet() == 2) {
        testComplete();
      }
View Full Code Here

Examples of io.vertx.core.net.NetSocketStream.endHandler()

    AtomicInteger done = new AtomicInteger();
    NetSocketStream stream = server.connectStream();
    stream.handler(req -> {});
    ThreadLocal<Object> stack = new ThreadLocal<>();
    stack.set(true);
    stream.endHandler(v -> {
      assertTrue(vertx.context().isEventLoopContext());
      assertNull(stack.get());
      if (done.incrementAndGet() == 2) {
        testComplete();
      }
View Full Code Here

Examples of io.vertx.core.streams.ReadStream.endHandler()

        vertx.fileSystem().open(testDir + pathSep + fileName2, new OpenOptions(), ar -> {
          if (ar.succeeded()) {
            WriteStream ws = ar.result();
            Pump p = Pump.pump(rs, ws);
            p.start();
            rs.endHandler(v -> {
              arr.result().close(car -> {
                if (car.failed()) {
                  fail(ar.cause().getMessage());
                } else {
                  ar.result().close(ar2 -> {
View Full Code Here

Examples of org.vertx.java.core.file.AsyncFile.endHandler()

        public void handle(AsyncResult<AsyncFile> ar) {
          final AsyncFile file = ar.result();
          Pump pump = Pump.createPump(file, req);
          pump.start();

          file.endHandler(new VoidHandler() {
            public void handle() {

              file.close(new AsyncResultHandler<Void>() {
                public void handle(AsyncResult<Void> ar) {
                  if (ar.succeeded()) {
View Full Code Here

Examples of org.vertx.java.core.net.NetSocket.endHandler()

                            handleShutdown(connectedInfo);
                        }
                    };
                    socketFromClient.readStream().endHandler(endHandler);
                    socketFromClient.readStream().exceptionHandler(exceptionHandler);
                    socketToServer.endHandler(endHandler);
                    socketToServer.exceptionHandler(exceptionHandler);

                    socketToServer.write(received);
                    Pump.createPump(socketToServer, socketFromClient.writeStream()).start();
                    Pump.createPump(socketFromClient.readStream(), socketToServer).start();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.