Created
November 22, 2014 22:01
-
-
Save trevorbernard/5311e1dcaaa074654a09 to your computer and use it in GitHub Desktop.
Experimental ZeroMQ Socket API with Context automagically managed for you
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.zeromq.zmq; | |
import static org.junit.Assert.assertTrue; | |
import java.util.Arrays; | |
import org.junit.Test; | |
import static org.zeromq.zmq.ZMQ.*; | |
public class PushPullTest { | |
@Test | |
public void testSimplePushPull() { | |
try (final Socket pull = new Socket(ZMQ_PULL); | |
final Socket push = new Socket(ZMQ_PUSH)) { | |
pull.bind("tcp://*:7210"); | |
push.connect("tcp://127.0.0.1:7210"); | |
byte[] expected = "hello".getBytes(); | |
push.send(expected); | |
byte[] actual = pull.receive(); | |
assertTrue(Arrays.equals(expected, actual)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment