Package org.zeromq.ZMQ

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


  public void listen() {
    listeningThread = new Thread(new Runnable() {
      @Override
      public void run() {
        final Socket socket = ZMQ.getSocket(org.zeromq.ZMQ.PULL);
        socket.bind(zmqUrl);
        while (true) {
          try {
            final ByteBuffer[] msg = getRequest(socket);
           
            if (msg[0] != null) {
View Full Code Here


        @Override
        public void run() {
            Socket frontend = ctx.socket(ZMQ.ROUTER);

            assertNotNull(frontend);
            frontend.bind("tcp://127.0.0.1:6660");

            Socket backend = ctx.socket(ZMQ.DEALER);
            assertNotNull(backend);
            backend.bind("tcp://127.0.0.1:6661");
View Full Code Here

            assertNotNull(frontend);
            frontend.bind("tcp://127.0.0.1:6660");

            Socket backend = ctx.socket(ZMQ.DEALER);
            assertNotNull(backend);
            backend.bind("tcp://127.0.0.1:6661");

            ZMQ.proxy(frontend, backend, null);

            frontend.close();
            backend.close();
View Full Code Here

    @Test
    public void testSingleFrameMessage() {
        ZContext ctx = new ZContext();

        Socket output = ctx.createSocket(ZMQ.PAIR);
        output.bind("inproc://zmsg.test");
        Socket input = ctx.createSocket(ZMQ.PAIR);
        input.connect("inproc://zmsg.test");

        // Test send and receive of a single ZMsg
        ZMsg msg = new ZMsg();
View Full Code Here

    @Test
    public void testMultiPart() {
        ZContext ctx = new ZContext();

        Socket output = ctx.createSocket(ZMQ.PAIR);
        output.bind("inproc://zmsg.test2");
        Socket input = ctx.createSocket(ZMQ.PAIR);
        input.connect("inproc://zmsg.test2");

        ZMsg msg = new ZMsg();
        for (int i = 0; i < 10; i++)
View Full Code Here

    @Test
    public void testClosedContext() {
        ZContext ctx = new ZContext();

        Socket output = ctx.createSocket(ZMQ.PAIR);
        output.bind("inproc://zmsg.test");
        Socket input = ctx.createSocket(ZMQ.PAIR);
        input.connect("inproc://zmsg.test");
       
        ZMsg msg = ZMsg.newStringMsg("Foo", "Bar");
        msg.send(output);
View Full Code Here

    @Test
    public void testSending() {
        ZContext ctx = new ZContext();
        Socket output = ctx.createSocket(ZMQ.PAIR);
        output.bind("inproc://zframe.test");
        Socket input = ctx.createSocket(ZMQ.PAIR);
        input.connect("inproc://zframe.test");

        // Send five different frames, test ZFRAME_MORE
        for (int i = 0; i < 5; i++) {
View Full Code Here

    @Test
    public void testCopyingAndDuplicating() {
        ZContext ctx = new ZContext();
        Socket output = ctx.createSocket(ZMQ.PAIR);
        output.bind("inproc://zframe.test");
        Socket input = ctx.createSocket(ZMQ.PAIR);
        input.connect("inproc://zframe.test");

        ZFrame f = new ZFrame("Hello");
        ZFrame copy = f.duplicate();
View Full Code Here

    @Test
    public void testReceiving() {
        ZContext ctx = new ZContext();
        Socket output = ctx.createSocket(ZMQ.PAIR);
        output.bind("inproc://zframe.test");
        Socket input = ctx.createSocket(ZMQ.PAIR);
        input.connect("inproc://zframe.test");

        // Send same frame five times
        ZFrame f = new ZFrame("Hello".getBytes());
View Full Code Here

    @Test
    public void testStringFrames() {
        ZContext ctx = new ZContext();
        Socket output = ctx.createSocket(ZMQ.PAIR);
        output.bind("inproc://zframe.test");
        Socket input = ctx.createSocket(ZMQ.PAIR);
        input.connect("inproc://zframe.test");

        ZFrame f1 = new ZFrame("Hello");
        assertEquals(5, f1.getData().length);
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.