@SuppressWarnings("unchecked")
    @Override
    public <T> void getBinary(String cacheKey, Class<T> type,
            IAsyncResultHandler<ISignalReadStream<T>> handler) {
        ISignalReadStream<T> rval;
        synchronized (mutex) {
            InfinispanCacheEntry entry = (InfinispanCacheEntry) getCache().get(cacheKey);
            if (entry != null) {
                if (entry.getExpiresOn() <= System.currentTimeMillis()) {
                    getCache().remove(cacheKey);
                    rval = null;
                } else {
                    final T head = (T) entry.getHead();
                    final IApimanBuffer dataBuffer = bufferFactory.createBuffer(entry.getData());
                    rval = new ISignalReadStream<T>() {
                        boolean finished = false;
                        IAsyncHandler<IApimanBuffer> bodyHandler;
                        IAsyncHandler<Void> endHandler;

                        @Override
                        public void bodyHandler(IAsyncHandler<IApimanBuffer> bodyHandler) {
                            this.bodyHandler = bodyHandler;
                        }
                        @Override
                        public void endHandler(IAsyncHandler<Void> endHandler) {
                            this.endHandler = endHandler;
                        }
                        @Override
                        public T getHead() {
                            return head;
                        }
                        @Override
                        public boolean isFinished() {
                            return finished;
                        }
                        @Override
                        public void abort(Throwable t) {
                            finished = true;
                        }
                        @Override
                        public void transmit() {
                            bodyHandler.handle(dataBuffer);
                            endHandler.handle(null);
                        }
                    };
                }
            } else {
                rval = null;
            }
        }
        handler.handle(AsyncResultImpl.create(rval));
    }
@see io.apiman.gateway.engine.components.ICacheStoreComponent#getBinary(java.lang.String, java.lang.Class, io.apiman.gateway.engine.async.IAsyncResultHandler)
gateway/engine/ispn/src/main/java/io/apiman/gateway/engine/ispn/InfinispanCacheStoreComponent.java