public boolean send(Socket socket, int flags) {
        if (socket == null) {
            throw new IllegalArgumentException("socket parameter must be set");
        }
        if (!hasData()) {
            throw new IllegalAccessError("Cannot send frame without data");
        }

        // Note the jzmq Socket.cpp JNI class does a memcpy of the byte data before calling
        // the 0MQ send function, so don't have to clone the message data again here.
        return socket.send(data, flags);
    }