Package org.zeromq.ZMQ

Examples of org.zeromq.ZMQ.Socket.recv()


        Thread.sleep(1000);
        router.sendMore("A");
        router.sendMore(new byte[] {Persistence.MESSAGE_ERROR});
        router.send(new byte[] {Persistence.STATUS_INTERNAL_ERROR});

        assertEquals(dealer.recv()[0], Persistence.STATUS_INTERNAL_ERROR);

        dealer.close();
        router.close();
        ctx.term();
    }
View Full Code Here


        router.sendMore("A");
        router.sendMore(new byte[] {Persistence.MESSAGE_RESPONSE});
        router.sendMore(new byte[] {STATUS_OK});
        router.send(ByteBuffer.wrap(new byte[8]).putLong(100).array());

        assertEquals(dealer.recv()[0], STATUS_OK);
        assertEquals(dealer.recv().length, 8);

        dealer.close();
        router.close();
        ctx.term();
View Full Code Here

        router.sendMore(new byte[] {Persistence.MESSAGE_RESPONSE});
        router.sendMore(new byte[] {STATUS_OK});
        router.send(ByteBuffer.wrap(new byte[8]).putLong(100).array());

        assertEquals(dealer.recv()[0], STATUS_OK);
        assertEquals(dealer.recv().length, 8);

        dealer.close();
        router.close();
        ctx.term();
    }
View Full Code Here

        router.sendMore(new byte[] {STATUS_OK});
        router.sendMore(path);
        router.sendMore(ByteBuffer.wrap(new byte[8]).putLong(0).array());
        router.send(ByteBuffer.wrap(new byte[8]).putLong(329).array());

        assertEquals(dealer.recv()[0], STATUS_OK);
        ByteBuffer content = ByteBuffer.wrap(dealer.recv());

        assertEquals(content.limit(), 329);
        assertEquals(0, content.get());
        int length = content.get();
View Full Code Here

        router.sendMore(path);
        router.sendMore(ByteBuffer.wrap(new byte[8]).putLong(0).array());
        router.send(ByteBuffer.wrap(new byte[8]).putLong(329).array());

        assertEquals(dealer.recv()[0], STATUS_OK);
        ByteBuffer content = ByteBuffer.wrap(dealer.recv());

        assertEquals(content.limit(), 329);
        assertEquals(0, content.get());
        int length = content.get();
        assertEquals(5, length);
View Full Code Here

        public int handle(ZLoop loop, PollItem item, Object arg)
        {
            clonesrv5 srv = (clonesrv5) arg;
            Socket socket = item.getSocket();

            byte[] identity = socket.recv();
            if (identity != null) {
                //  Request is in second frame of message
                String request = socket.recvStr();
                String subtree = null;
                if (request.equals("ICANHAZ?")) {
View Full Code Here

        System.out.println("Waiting subscribers");
        //  Get synchronization from subscribers
        int subscribers = 0;
        while (subscribers < SUBSCRIBERS_EXPECTED) {
            //  - wait for synchronization request
            syncservice.recv(0);

            //  - send synchronization reply
            syncservice.send("", 0);
            subscribers++;
        }
View Full Code Here

          stateSequence = kvMsg.getSequence();
        }

        // execute state snapshot request
        if (poller.pollin(1)) {
          byte[] identity = snapshot.recv(0);
                    if (identity == null)
                        break;
          String request = new String(snapshot.recv(0));

                    if (!request.equals("ICANHAZ?")) {
View Full Code Here

        // execute state snapshot request
        if (poller.pollin(1)) {
          byte[] identity = snapshot.recv(0);
                    if (identity == null)
                        break;
          String request = new String(snapshot.recv(0));

                    if (!request.equals("ICANHAZ?")) {
                        System.out.println("E: bad request, aborting");
                        break;
                    }
View Full Code Here

        //  Step 2 relays the signal to step 3
        Thread step2 = new Step2 (context);
        step2.start();
       
        //  Wait for signal
        receiver.recv(0);
        receiver.close ();
   
        System.out.println ("Test successful!");
        context.term ();
    }
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.