public Socket createSocket(int type) {
        if (context == null)
            context = ZMQ.context(ioThreads);

        // Create and register socket
        Socket socket = context.socket(type);
        sockets.add(socket);
        return socket;
    }