private MsgAllocator allocator(Class<?> clazz)
    {
        try {
            Class<? extends MsgAllocator> msgAllocator = clazz.asSubclass(MsgAllocator.class);
            return msgAllocator.newInstance();
        }
        catch (InstantiationException | IllegalAccessException e) {
            throw new IllegalArgumentException(e);
        }
    }
@Test
    public void testAllocator()
    {
        options.setSocketOpt(ZMQ.ZMQ_MSG_ALLOCATOR, new MsgAllocatorDirect());
        assertThat(options.getSocketOpt(ZMQ.ZMQ_MSG_ALLOCATOR), is(options.allocator));
    }