diff --git a/ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/TrackerAndRankerInterceptor.java b/ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/TrackerAndRankerInterceptor.java
new file mode 100644
index 0000000..9f7b4cf
--- /dev/null
+++ b/ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/TrackerAndRankerInterceptor.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core.test.interceptors;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.annotations.ServiceProperty;
+import org.apache.felix.ipojo.dependency.interceptors.DefaultDependencyInterceptor;
+import org.apache.felix.ipojo.dependency.interceptors.ServiceRankingInterceptor;
+import org.apache.felix.ipojo.dependency.interceptors.ServiceTrackingInterceptor;
+import org.apache.felix.ipojo.dependency.interceptors.TransformedServiceReference;
+import org.apache.felix.ipojo.runtime.core.test.services.Setter;
+import org.apache.felix.ipojo.util.DependencyModel;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * An interceptor implements both ranking and tracking interfaces.
+ */
+@Component(immediate = true)
+@Provides
+public class TrackerAndRankerInterceptor extends DefaultDependencyInterceptor implements Setter,
+        ServiceTrackingInterceptor, ServiceRankingInterceptor {
+
+    private static final int HIGH = 1;
+    private static final int LOW = 0;
+
+    @ServiceProperty
+    private String target;
+
+    GradeComparator comparator = new GradeComparator();
+    private int mode = HIGH;
+    private boolean reverse = false;
+
+    @Override
+    public List<ServiceReference> getServiceReferences(DependencyModel dependency, List<ServiceReference> matching) {
+        List<ServiceReference> references = new ArrayList<ServiceReference>();
+        for (ServiceReference ref : matching) {
+            if (ref.getProperty("grade") != null) {
+                references.add(ref);
+            }
+        }
+
+        Collections.sort(references, comparator);
+        if (reverse) {
+            Collections.reverse(references);
+        }
+        return references;
+    }
+
+    @Override
+    public List<ServiceReference> onServiceArrival(DependencyModel dependency, List<ServiceReference> matching, ServiceReference<?> reference) {
+        return getServiceReferences(dependency, matching);
+    }
+
+    @Override
+    public List<ServiceReference> onServiceDeparture(DependencyModel dependency, List<ServiceReference> matching, ServiceReference<?> reference) {
+        return getServiceReferences(dependency, matching);
+    }
+
+    @Override
+    public List<ServiceReference> onServiceModified(DependencyModel dependency, List<ServiceReference> matching, ServiceReference<?> reference) {
+        return getServiceReferences(dependency, matching);
+    }
+
+    @Override
+    public <S> TransformedServiceReference<S> accept(DependencyModel dependency, BundleContext context, TransformedServiceReference<S> ref) {
+        // Only accept services having a grade in LOW or HIGH according to the mode.
+        if (mode == HIGH) {
+           if (((Integer) ref.get("grade")) > 3) {
+               return ref;
+           }
+        } else {
+            if (((Integer) ref.get("grade")) <= 3) {
+                return ref;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public void set(String newValue) {
+        if (newValue.contains("HIGH")) {
+            mode = HIGH;
+            invalidateMatchingServices();
+        }
+        if (newValue.contains("LOW")) {
+            mode = LOW;
+            invalidateMatchingServices();
+        }
+        if (newValue.contains("REVERSE")) {
+            reverse = true;
+            invalidateSelectedServices();
+        }
+    }
+
+    /**
+     * Notifies the managed dependencies of a change in the set of services selected by this interceptor.
+     * The dependency will call the getServiceReferences method to recompute the set of selected services.
+     */
+    public void invalidateSelectedServices() {
+        List<DependencyModel> list = new ArrayList<DependencyModel>();
+        synchronized (this) {
+            list.addAll(dependencies);
+        }
+
+        for (DependencyModel dep : list) {
+            dep.invalidateSelectedServices();
+        }
+    }
+
+    /**
+     * Notifies the managed dependencies of a change in the set of services accepted by this interceptor.
+     * The dependency will call the accept method to recompute the set of matching services.
+     */
+    public void invalidateMatchingServices() {
+        List<DependencyModel> list = new ArrayList<DependencyModel>();
+        synchronized (this) {
+            list.addAll(dependencies);
+        }
+
+        for (DependencyModel dep : list) {
+            dep.invalidateMatchingServices();
+        }
+    }
+}
diff --git a/ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestCombinationOfInterceptors.java b/ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestCombinationOfInterceptors.java
new file mode 100644
index 0000000..36108c5
--- /dev/null
+++ b/ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestCombinationOfInterceptors.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.runtime.core.test.dependencies;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.test.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.test.services.Setter;
+import org.junit.Test;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+/**
+ * Checks the combination of tracking and ranking interceptors.
+ *
+ * First, the tracking interceptor selects the references, it also transforms them.
+ * Then, the ranking interceptor sorts the remaining references.
+ */
+public class TestCombinationOfInterceptors extends Common {
+
+    private ComponentInstance provider1;
+    private ComponentInstance provider2;
+    private ComponentInstance provider3;
+    private ComponentInstance provider4;
+    private ComponentInstance provider5;
+    private ComponentInstance provider6;
+
+    @Test
+    public void test() {
+
+        provider1 = provider(0);
+        provider2 = provider(1);
+        provider3 = provider(2);
+        provider4 = provider(3);
+        provider5 = provider(4);
+        provider6 = provider(5);
+
+        // Create the interceptor
+        Properties configuration = new Properties();
+        configuration.put("target", "(dependency.id=foo)");
+        ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.test.interceptors" +
+                ".TrackerAndRankerInterceptor", configuration);
+
+        // Create the FooConsumer
+        ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.test.components.FooConsumer");
+
+        // Check we are using provider 2
+        osgiHelper.waitForService(CheckService.class.getName(), null, 1000, true);
+        CheckService check = osgiHelper.getServiceObject(CheckService.class);
+        assertThat(check.getProps().get("grade")).isEqualTo(5);
+
+        provider6.dispose();
+
+        assertThat(check.getProps().get("grade")).isEqualTo(4);
+
+        // Change range
+        Setter setter = osgiHelper.getServiceObject(Setter.class);
+        setter.set("LOW REVERSE");
+
+//        check = osgiHelper.getServiceObject(CheckService.class);
+//        assertThat(check.getProps().get("grade")).isEqualTo(3);
+//
+//        setter.set("REVERSE");
+//        check = osgiHelper.getServiceObject(CheckService.class);
+        assertThat(check.getProps().get("grade")).isEqualTo(0);
+    }
+
+
+    private ComponentInstance provider(int i) {
+        Dictionary<String, String> configuration = new Hashtable<String, String>();
+        configuration.put("grade", Integer.toString(i));
+        return ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.test.components.FooProvider",
+                configuration);
+    }
+}
