@SuppressWarnings("deprecation")
    public Object getSocketOpt(int option)
    {
        switch (option) {
        case ZMQ.ZMQ_SNDHWM:
            return sendHwm;

        case ZMQ.ZMQ_RCVHWM:
            return recvHwm;

        case ZMQ.ZMQ_AFFINITY:
            return affinity;

        case ZMQ.ZMQ_IDENTITY:
            return identity;

        case ZMQ.ZMQ_RATE:
            return rate;

        case ZMQ.ZMQ_RECOVERY_IVL:
            return recoveryIvl;

        case ZMQ.ZMQ_SNDBUF:
            return sndbuf;

        case ZMQ.ZMQ_RCVBUF:
            return rcvbuf;

        case ZMQ.ZMQ_TOS:
            return tos;

        case ZMQ.ZMQ_TYPE:
            return type;

        case ZMQ.ZMQ_LINGER:
            return linger;

        case ZMQ.ZMQ_RECONNECT_IVL:
            return reconnectIvl;

        case ZMQ.ZMQ_RECONNECT_IVL_MAX:
            return reconnectIvlMax;

        case ZMQ.ZMQ_BACKLOG:
            return backlog;

        case ZMQ.ZMQ_MAXMSGSIZE:
            return maxMsgSize;

        case ZMQ.ZMQ_MULTICAST_HOPS:
            return multicastHops;

        case ZMQ.ZMQ_RCVTIMEO:
            return recvTimeout;

        case ZMQ.ZMQ_SNDTIMEO:
            return sendTimeout;

        case ZMQ.ZMQ_IPV4ONLY:
            return !ipv6;

        case ZMQ.ZMQ_IPV6:
            return ipv6;

        case ZMQ.ZMQ_TCP_KEEPALIVE:
            return tcpKeepAlive;

        case ZMQ.ZMQ_IMMEDIATE:
            return immediate;

        case ZMQ.ZMQ_DELAY_ATTACH_ON_CONNECT:
            return !immediate;

        case ZMQ.ZMQ_SOCKS_PROXY:
            return socksProxyAddress;

        case ZMQ.ZMQ_TCP_KEEPALIVE_CNT:
            return tcpKeepAliveCnt;
        case ZMQ.ZMQ_TCP_KEEPALIVE_IDLE:
            return tcpKeepAliveIdle;
        case ZMQ.ZMQ_TCP_KEEPALIVE_INTVL:
            return tcpKeepAliveIntvl;

        case ZMQ.ZMQ_MECHANISM:
            return mechanism;

        case ZMQ.ZMQ_PLAIN_SERVER:
            return asServer && mechanism == Mechanisms.PLAIN;

        case ZMQ.ZMQ_PLAIN_USERNAME:
            return plainUsername;

        case ZMQ.ZMQ_PLAIN_PASSWORD:
            return plainPassword;

        case ZMQ.ZMQ_ZAP_DOMAIN:
            return zapDomain;

        case ZMQ.ZMQ_LAST_ENDPOINT:
            return lastEndpoint;

        case ZMQ.ZMQ_CURVE_SERVER:
            return asServer && mechanism == Mechanisms.CURVE;

        case ZMQ.ZMQ_CURVE_PUBLICKEY:
            return curvePublicKey;

        case ZMQ.ZMQ_CURVE_SERVERKEY:
            return curveServerKey;

        case ZMQ.ZMQ_CURVE_SECRETKEY:
            return curveSecretKey;

        case ZMQ.ZMQ_CONFLATE:
            return conflate;

        case ZMQ.ZMQ_GSSAPI_SERVER:
            return asServer && mechanism == Mechanisms.GSSAPI;

        case ZMQ.ZMQ_GSSAPI_PRINCIPAL:
            return gssPrincipal;

        case ZMQ.ZMQ_GSSAPI_SERVICE_PRINCIPAL:
            return gssServicePrincipal;

        case ZMQ.ZMQ_GSSAPI_PLAINTEXT:
            return gssPlaintext;

        case ZMQ.ZMQ_HANDSHAKE_IVL:
            return handshakeIvl;

        case ZMQ.ZMQ_HEARTBEAT_IVL:
            return heartbeatInterval;

        case ZMQ.ZMQ_HEARTBEAT_TIMEOUT:
            return heartbeatTimeout;

        case ZMQ.ZMQ_HEARTBEAT_TTL:
            // Convert the internal deciseconds value to milliseconds
            return heartbeatTtl * 100;

        case ZMQ.ZMQ_HEARTBEAT_CONTEXT:
            return heartbeatContext;

        case ZMQ.ZMQ_MSG_ALLOCATOR:
            return allocator;

        case ZMQ.ZMQ_MSG_ALLOCATION_HEAP_THRESHOLD:
            if (allocator instanceof MsgAllocatorThreshold) {
                MsgAllocatorThreshold all = (MsgAllocatorThreshold) allocator;
                return all.threshold;
            }
            return -1;

        case ZMQ.ZMQ_SELECTOR_PROVIDERCHOOSER:
            return selectorChooser;

        case ZMQ.ZMQ_AS_TYPE:
            return asType;

        case ZMQ.ZMQ_SELFADDR_PROPERTY_NAME:
            return selfAddressPropertyName;

        default:
            throw new IllegalArgumentException("option=" + option);
        }
    }
@Test
    public void testDefaultValue()
    {
        assertThat(options.getSocketOpt(ZMQ.ZMQ_GSSAPI_PRINCIPAL), is(options.gssPrincipal));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_GSSAPI_SERVICE_PRINCIPAL), is(options.gssServicePrincipal));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_HANDSHAKE_IVL), is(options.handshakeIvl));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_IDENTITY), is(options.identity));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_IMMEDIATE), is(options.immediate));
        //        assertThat(options.getSocketOpt(ZMQ.ZMQ_TCP_ACCEPT_FILTER), is((Object)options.ipcAcceptFilters));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_IPV6), is(options.ipv6));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_LAST_ENDPOINT), is(options.lastEndpoint));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_LINGER), is(options.linger));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_MAXMSGSIZE), is(options.maxMsgSize));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_MECHANISM), is(options.mechanism));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_MULTICAST_HOPS), is(options.multicastHops));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_PLAIN_PASSWORD), is(options.plainPassword));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_PLAIN_USERNAME), is(options.plainUsername));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_RATE), is(options.rate));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_RCVBUF), is(options.rcvbuf));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_RECONNECT_IVL), is(options.reconnectIvl));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_RECONNECT_IVL_MAX), is(options.reconnectIvlMax));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_RECOVERY_IVL), is(options.recoveryIvl));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_RCVHWM), is(options.recvHwm));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_RCVTIMEO), is(options.recvTimeout));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_SNDHWM), is(options.sendHwm));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_SNDTIMEO), is(options.sendTimeout));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_SNDBUF), is(options.sndbuf));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_SOCKS_PROXY), is(options.socksProxyAddress));
        //        assertThat(options.getSocketOpt(ZMQ.ZMQ_TCP_ACCEPT_FILTER), is((Object)options.tcpAcceptFilters));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_TCP_KEEPALIVE), is(options.tcpKeepAlive));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_TOS), is(options.tos));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_TYPE), is(options.type));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_ZAP_DOMAIN), is(options.zapDomain));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_HANDSHAKE_IVL), is(options.handshakeIvl));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_HEARTBEAT_IVL), is(options.heartbeatInterval));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_HEARTBEAT_TIMEOUT), is(options.heartbeatTimeout));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_HEARTBEAT_TTL), is(options.heartbeatTtl));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_SELECTOR_PROVIDERCHOOSER), nullValue());
        assertThat(options.getSocketOpt(ZMQ.ZMQ_IDENTITY), is(new byte[0]));
        assertThat(options.getSocketOpt(ZMQ.ZMQ_SELFADDR_PROPERTY_NAME), nullValue());
    }