public Metadata()
    {
        super();
    }
@Test
    public void testMetadata() throws IOException, InterruptedException
    {
        int port = Utils.findOpenPort();
        String host = "tcp://127.0.0.1:" + port;

        Ctx ctx = ZMQ.createContext();

        //  Spawn ZAP handler
        //  We create and bind ZAP socket in main thread to avoid case
        //  where child thread does not start up fast enough.
        SocketBase handler = ZMQ.socket(ctx, ZMQ.ZMQ_REP);
        assertThat(handler, notNullValue());
        boolean rc = ZMQ.bind(handler, "inproc://zeromq.zap.01");
        assertThat(rc, is(true));

        Thread thread = new Thread(new ZapHandler(handler));
        thread.start();

        //  Server socket will accept connections
        SocketBase server = ZMQ.socket(ctx, ZMQ.ZMQ_DEALER);
        assertThat(server, notNullValue());
        SocketBase client = ZMQ.socket(ctx, ZMQ.ZMQ_DEALER);
        assertThat(client, notNullValue());

        ZMQ.setSocketOption(server, ZMQ.ZMQ_ZAP_DOMAIN, "DOMAIN");

        ZMQ.setSocketOption(server, ZMQ.ZMQ_SELFADDR_PROPERTY_NAME, "X-Local-Address");

        rc = ZMQ.bind(server, host);
        assertThat(rc, is(true));

        rc = ZMQ.connect(client, host);
        assertThat(rc, is(true));

        int ret = ZMQ.send(client, "This is a message", 0);
        assertThat(ret, is(17));

        Msg msg = ZMQ.recv(server, 0);
        assertThat(msg, notNullValue());

        String prop = ZMQ.getMessageMetadata(msg, "Socket-Type");
        assertThat(prop, is("DEALER"));

        prop = ZMQ.getMessageMetadata(msg, "User-Id");
        assertThat(prop, is("anonymous"));

        prop = ZMQ.getMessageMetadata(msg, "Peer-Address");
        assertThat(prop.startsWith("127.0.0.1:"), is(true));

        prop = ZMQ.getMessageMetadata(msg, "no such");
        assertThat(prop, nullValue());

        prop = ZMQ.getMessageMetadata(msg, "Hello");
        assertThat(prop, is("World"));

        prop = ZMQ.getMessageMetadata(msg, "X-Local-Address");
        assertThat(prop, is("127.0.0.1:" + port));

        ZMQ.closeZeroLinger(server);
        ZMQ.closeZeroLinger(client);

        //  Shutdown
        ZMQ.term(ctx);
        //  Wait until ZAP handler terminates
        thread.join();
    }