@@ -0,0 +1,1810 @@
+package org.zeromq;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.junit.Test;%0A%0Aimport org.zeromq.ZMQ.Socket;%0A%0A// For issue: https://github.com/zeromq/jeromq/issues/198%0Apublic class TestRapidOpenCloseSocket%0A%7B%0A  @Test%0A  public void testRapidOpenCloseSocket() throws Exception%0A  %7B%0A    for (int i = 0; i %3C 50; i++) %7B%0A      performTest();%0A    %7D%0A  %7D%0A%0A  private void performTest() throws Exception%0A  %7B%0A    ZContext ctx = new ZContext();%0A%0A    Socket recvMsgSock = ctx.createSocket(ZMQ.PULL);%0A    recvMsgSock.bind(%22tcp://*:%22 + Utils.findOpenPort());%0A    Socket processMsgSock = ctx.createSocket(ZMQ.PUSH);%0A    processMsgSock.bind(%22inproc://process-msg%22);%0A%0A    List%3CSocket%3E workerSocks = new ArrayList%3CSocket%3E();%0A    for (int i = 0; i %3C 5; i++) %7B%0A      Socket workerSock = ctx.createSocket(ZMQ.PULL);%0A      workerSock.connect(%22inproc://process-msg%22);%0A      workerSocks.add(workerSock);%0A    %7D%0A%0A    ZMQQueue queue = new ZMQQueue(ctx.getContext(), recvMsgSock, processMsgSock);%0A    Thread proxyThr = new Thread(queue);%0A    proxyThr.setName(%22Proxy thr%22);%0A    proxyThr.start();%0A%0A    for (final Socket workerSock : workerSocks) %7B%0A      Thread workerThr = new Thread(new Runnable()%0A      %7B%0A        @Override%0A        public void run()%0A        %7B%0A          try %7B%0A            while (true) %7B%0A              byte%5B%5D msg = workerSock.recv();%0A              // Process the msg!%0A            %7D%0A          %7D%0A          catch (Exception e) %7B%0A          %7D%0A        %7D%0A      %7D);%0A      workerThr.setName(%22A worker thread%22);%0A      workerThr.start();%0A    %7D%0A%0A    try %7B%0A      Thread.sleep(100);%0A    %7D%0A    catch (InterruptedException e) %7B%0A      Thread.currentThread().interrupt();%0A      throw new RuntimeException(e);%0A    %7D%0A%0A    System.out.println(%22Closing now%22);%0A%0A    ctx.destroy();%0A    System.out.println(%22Successfully closed%22);%0A  %7D%0A%7D%0A

add failing test for issue #198