#vulnerable code 
                                @Test
    public void testConnectResolve()
    {
        System.out.println("test_connect_resolve running...\n");

        Ctx ctx = ZMQ.init(1);
        assertThat(ctx, notNullValue());

        //  Create pair of socket, each with high watermark of 2. Thus the total
        //  buffer space should be 4 messages.
        SocketBase sock = ZMQ.socket(ctx, ZMQ.ZMQ_PUB);
        assertThat(sock, notNullValue());

        boolean brc = ZMQ.connect(sock, "tcp://localhost:1234");
        assertThat(brc, is(true));

        /*
        try {
            brc = ZMQ.connect (sock, "tcp://foobar123xyz:1234");
            assertTrue(false);
        } catch (IllegalArgumentException e) {
        }
        */

        ZMQ.close(sock);
        ZMQ.term(ctx);
    } 
                            #location 26 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                @Test
    public void testConnectResolve() throws IOException
    {
        int port = Utils.findOpenPort();
        System.out.println("test_connect_resolve running...\n");

        Ctx ctx = ZMQ.init(1);
        assertThat(ctx, notNullValue());

        //  Create pair of socket, each with high watermark of 2. Thus the total
        //  buffer space should be 4 messages.
        SocketBase sock = ZMQ.socket(ctx, ZMQ.ZMQ_PUB);
        assertThat(sock, notNullValue());

        boolean brc = ZMQ.connect(sock, "tcp://localhost:" + port);
        assertThat(brc, is(true));

        /*
        try {
            brc = ZMQ.connect (sock, "tcp://foobar123xyz:" + port);
            assertTrue(false);
        } catch (IllegalArgumentException e) {
        }
        */

        ZMQ.close(sock);
        ZMQ.term(ctx);
    }