diff --git a/core/api/src/main/java/org/onosproject/cluster/ProxyFactory.java b/core/api/src/main/java/org/onosproject/cluster/ProxyFactory.java
new file mode 100644
index 0000000..271dc10
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/cluster/ProxyFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed 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.onosproject.cluster;
+
+/**
+ * Constructs proxy instances for nodes in the cluster.
+ * <p>
+ * The proxy factory constructs proxy instances for the master node of a given {@link NodeId}.
+ * When a proxy method is invoked, the method will be called on the provided node.
+ */
+public interface ProxyFactory<T> {
+
+    /**
+     * Returns the proxy for the given peer.
+     * <p>
+     * The proxy instance is a multiton that is cached internally in the factory, so calling this method
+     *
+     * @param nodeId the peer node identifier
+     * @return the proxy for the given peer
+     */
+    T getProxyFor(NodeId nodeId);
+
+}
diff --git a/core/api/src/main/java/org/onosproject/cluster/ProxyService.java b/core/api/src/main/java/org/onosproject/cluster/ProxyService.java
new file mode 100644
index 0000000..bdacd67
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/cluster/ProxyService.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed 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.onosproject.cluster;
+
+import org.onosproject.store.service.Serializer;
+
+/**
+ * Manages remote proxy services and instances.
+ * <p>
+ * This service can be used to make arbitrary method calls on remote objects in ONOS. The objects on which the methods
+ * are called are referred to as <em>services</em> and are made available to the proxy service by
+ * {@link #registerProxyService(Class, Object, Serializer) registering} a service instance. Services must implement
+ * an <em>interface</em> which can be used to construct a Java proxy. Proxy interfaces may define either synchronous
+ * or asynchronous methods. Synchronous proxy methods will be blocked, and asynchronous proxy methods (which must
+ * return {@link java.util.concurrent.CompletableFuture}) will be proxied using asynchronous intra-cluster
+ * communication. To make a remote call on a proxy service, get an instance of the {@link ProxyFactory} for the service
+ * type using {@link #getProxyFactory(Class, Serializer)}. The proxy factory is responsible for constructing proxy
+ * instances for each node in the cluster. Once a proxy instance is constructed, calls on the proxy instance will be
+ * transparently serialized and sent to the associated peer and be executed on the proxy service registered by that
+ * peer.
+ */
+public interface ProxyService {
+
+    /**
+     * Returns a new proxy factory for the given type.
+     * <p>
+     * The proxy {@code type} passed to this method must be an interface. The proxy factory can be used to construct
+     * proxy instances for different nodes in the cluster.
+     *
+     * @param type       the proxy type
+     * @param serializer the proxy serializer
+     * @param <T>        the proxy type
+     * @return the proxy factory
+     * @throws IllegalArgumentException if the {@code type} is not an interface
+     */
+    <T> ProxyFactory<T> getProxyFactory(Class<T> type, Serializer serializer);
+
+    /**
+     * Registers a proxy service.
+     * <p>
+     * The proxy {@code type} passed to this method must be an interface. The {@code proxy} should be an implementation
+     * of that interface on which methods will be called when proxy calls from other nodes are received.
+     *
+     * @param type       the proxy type
+     * @param proxy      the proxy service
+     * @param serializer the proxy serializer
+     * @param <T>        the proxy type
+     * @throws IllegalArgumentException if the {@code type} is not an interface
+     */
+    <T> void registerProxyService(Class<? super T> type, T proxy, Serializer serializer);
+
+    /**
+     * Unregisters the proxy service of the given type.
+     * <p>
+     * Once the proxy service has been unregistered, calls to the proxy instance on this node will fail.
+     *
+     * @param type the proxy service type to unregister
+     */
+    void unregisterProxyService(Class<?> type);
+
+}
diff --git a/core/net/src/main/java/org/onosproject/cluster/impl/AbstractProxyManager.java b/core/net/src/main/java/org/onosproject/cluster/impl/AbstractProxyManager.java
new file mode 100644
index 0000000..911b465
--- /dev/null
+++ b/core/net/src/main/java/org/onosproject/cluster/impl/AbstractProxyManager.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed 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.onosproject.cluster.impl;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import com.google.common.collect.Maps;
+import org.onosproject.store.cluster.messaging.MessageSubject;
+
+/**
+ * Implementation of the proxy service.
+ */
+public abstract class AbstractProxyManager {
+
+    /**
+     * Wrapper for a proxy service which handles registration of proxy methods as {@code ClusterCommunicationService}
+     * subscribers.
+     */
+    class ProxyService {
+        private final Map<Method, OperationService> operations = Maps.newConcurrentMap();
+
+        ProxyService(
+            Object instance,
+            Class<?> type,
+            String prefix,
+            OperationServiceFactory syncServiceFactory,
+            OperationServiceFactory asyncServiceFactory) {
+            operations.putAll(getMethodMap(type, prefix).entrySet().stream()
+                .map(entry -> {
+                    if (entry.getValue().type() == Operation.Type.SYNC) {
+                        return Maps.immutableEntry(
+                            entry.getKey(),
+                            syncServiceFactory.create(instance, entry.getKey(), entry.getValue()));
+                    } else {
+                        return Maps.immutableEntry(
+                            entry.getKey(),
+                            asyncServiceFactory.create(instance, entry.getKey(), entry.getValue()));
+                    }
+                }).collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue())));
+        }
+
+        /**
+         * Closes the proxy service.
+         */
+        void close() {
+            operations.values().forEach(operation -> operation.close());
+        }
+    }
+
+    /**
+     * Operation service factory.
+     */
+    @FunctionalInterface
+    interface OperationServiceFactory {
+        OperationService create(Object instance, Method method, Operation operation);
+    }
+
+    /**
+     * Wrapper for a single proxy service operation which handles registration of subscribers and invocation
+     * of service instance methods.
+     */
+    abstract class OperationService {
+        protected final Object instance;
+        protected final Method method;
+        protected final Operation operation;
+
+        OperationService(Object instance, Method method, Operation operation) {
+            this.instance = instance;
+            this.method = method;
+            this.operation = operation;
+        }
+
+        /**
+         * Invokes the method with the given arguments.
+         *
+         * @param args the arguments with which to invoke the operation
+         * @param <T>  the operation return type
+         * @return the operation return value
+         */
+        @SuppressWarnings("unchecked")
+        <T> T invoke(Object[] args) {
+            try {
+                return (T) method.invoke(instance, args);
+            } catch (IllegalAccessException | InvocationTargetException e) {
+                throw new IllegalStateException(e);
+            }
+        }
+
+        /**
+         * Closes the operation service.
+         */
+        abstract void close();
+    }
+
+    /**
+     * Proxy invocation handler which routes proxy method calls to the correct node and subscriber via
+     * {@code ClusterCommunicationService}.
+     */
+    class ProxyInvocationHandler implements InvocationHandler {
+        private final Map<Method, OperationHandler> handlers = Maps.newConcurrentMap();
+
+        ProxyInvocationHandler(
+            Class<?> type,
+            String prefix,
+            OperationHandlerFactory syncHandlerFactory,
+            OperationHandlerFactory asyncHandlerFactory) {
+            handlers.putAll(getMethodMap(type, prefix).entrySet().stream()
+                .map(entry -> {
+                    if (entry.getValue().type() == Operation.Type.SYNC) {
+                        return Maps.immutableEntry(entry.getKey(), syncHandlerFactory.create(entry.getValue()));
+                    } else {
+                        return Maps.immutableEntry(entry.getKey(), asyncHandlerFactory.create(entry.getValue()));
+                    }
+                }).collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue())));
+        }
+
+        @Override
+        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+            OperationHandler handler = handlers.get(method);
+            if (handler == null) {
+                throw new IllegalStateException("Unknown proxy operation " + method.getName());
+            }
+            return handler.apply(args);
+        }
+    }
+
+    /**
+     * Operation handler factory.
+     */
+    @FunctionalInterface
+    interface OperationHandlerFactory {
+        OperationHandler create(Operation operation);
+    }
+
+    /**
+     * Invocation handler for an individual proxy operation.
+     */
+    abstract class OperationHandler implements Function<Object[], Object> {
+        protected final Operation operation;
+
+        OperationHandler(Operation operation) {
+            this.operation = operation;
+        }
+    }
+
+    /**
+     * Recursively finds operations defined by the given type and its implemented interfaces.
+     *
+     * @param type   the type for which to find operations
+     * @param prefix the prefix with which to generate message subjects
+     * @return the operations defined by the given type and its parent interfaces
+     */
+    Map<Method, Operation> getMethodMap(Class<?> type, String prefix) {
+        String service = type.getCanonicalName().replace(".", "-");
+        Map<Method, Operation> methods = new HashMap<>();
+        for (Method method : type.getDeclaredMethods()) {
+            String name = method.getName();
+            if (methods.values().stream().anyMatch(op -> op.name.equals(name))) {
+                throw new IllegalArgumentException("Method " + name + " is ambiguous");
+            }
+
+            Class<?> returnType = method.getReturnType();
+            if (CompletableFuture.class.isAssignableFrom(returnType)) {
+                methods.put(method, new Operation(Operation.Type.ASYNC, prefix, service, name, method));
+            } else {
+                methods.put(method, new Operation(Operation.Type.SYNC, prefix, service, name, method));
+            }
+        }
+        for (Class<?> iface : type.getInterfaces()) {
+            methods.putAll(getMethodMap(iface, prefix));
+        }
+        return methods;
+    }
+
+    /**
+     * Simple data class for proxy operation metadata.
+     */
+    static class Operation {
+
+        /**
+         * Operation type.
+         */
+        enum Type {
+            SYNC,
+            ASYNC,
+        }
+
+        private final Type type;
+        private final String service;
+        private final String name;
+        private final Method method;
+        private final MessageSubject subject;
+
+        Operation(Type type, String prefix, String service, String name, Method method) {
+            this.type = type;
+            this.service = service;
+            this.name = name;
+            this.method = method;
+            this.subject = new MessageSubject(String.format("%s-%s-%s", prefix, service, name));
+        }
+
+        /**
+         * Returns the operation type.
+         *
+         * @return the operation type
+         */
+        Type type() {
+            return type;
+        }
+
+        /**
+         * Returns the service name of the service to which this operation belongs.
+         *
+         * @return the service name of the service to which this operation belongs
+         */
+        String service() {
+            return service;
+        }
+
+        /**
+         * Returns the operation name.
+         *
+         * @return the operation name
+         */
+        String name() {
+            return name;
+        }
+
+        /**
+         * Returns the operation method.
+         *
+         * @return the operation method
+         */
+        Method method() {
+            return method;
+        }
+
+        /**
+         * Returns the operation message subject.
+         *
+         * @return the operation message subject
+         */
+        MessageSubject subject() {
+            return subject;
+        }
+    }
+}
diff --git a/core/net/src/main/java/org/onosproject/cluster/impl/ProxyManager.java b/core/net/src/main/java/org/onosproject/cluster/impl/ProxyManager.java
new file mode 100644
index 0000000..945172a
--- /dev/null
+++ b/core/net/src/main/java/org/onosproject/cluster/impl/ProxyManager.java
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed 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.onosproject.cluster.impl;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.function.Function;
+
+import com.google.common.collect.Maps;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.util.OrderedExecutor;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.cluster.ProxyFactory;
+import org.onosproject.cluster.ProxyService;
+import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
+import org.onosproject.store.service.Serializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static org.onlab.util.Tools.groupedThreads;
+
+/**
+ * Implementation of the proxy service.
+ */
+@Component(immediate = true)
+@Service
+public class ProxyManager extends AbstractProxyManager implements ProxyService {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private static final String MESSAGE_PREFIX = "proxy";
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ClusterCommunicationService clusterCommunicator;
+
+    private final ExecutorService proxyServiceExecutor =
+        Executors.newFixedThreadPool(
+            Math.min(Math.max(Runtime.getRuntime().availableProcessors(), 4), 16),
+            groupedThreads("onos/proxy", "service-executor", log));
+
+    private final Map<Class, ProxyService> services = Maps.newConcurrentMap();
+
+    @Activate
+    public void activate() {
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        proxyServiceExecutor.shutdownNow();
+        log.info("Stopped");
+    }
+
+    @Override
+    public <T> ProxyFactory<T> getProxyFactory(Class<T> type, Serializer serializer) {
+        checkArgument(type.isInterface(), "proxy type must be an interface");
+        return new ProxyManagerFactory<>(type, serializer);
+    }
+
+    @Override
+    public <T> void registerProxyService(Class<? super T> type, T instance, Serializer serializer) {
+        checkArgument(type.isInterface(), "proxy type must be an interface");
+        Executor executor = new OrderedExecutor(proxyServiceExecutor);
+        services.computeIfAbsent(type, t -> new ProxyService(instance, t, MESSAGE_PREFIX,
+            (i, m, o) -> new SyncOperationService(i, m, o, serializer, executor),
+            (i, m, o) -> new AsyncOperationService(i, m, o, serializer)));
+    }
+
+    @Override
+    public void unregisterProxyService(Class<?> type) {
+        ProxyService service = services.remove(type);
+        if (service != null) {
+            service.close();
+        }
+    }
+
+    /**
+     * Internal proxy factory.
+     */
+    private class ProxyManagerFactory<T> implements ProxyFactory<T> {
+        private final Class<T> type;
+        private final Serializer serializer;
+        private final Map<NodeId, T> proxyInstances = Maps.newConcurrentMap();
+
+        ProxyManagerFactory(Class<T> type, Serializer serializer) {
+            this.type = type;
+            this.serializer = serializer;
+        }
+
+        @Override
+        @SuppressWarnings("unchecked")
+        public T getProxyFor(NodeId nodeId) {
+            // Avoid unnecessary locking of computeIfAbsent if possible.
+            T proxyInstance = proxyInstances.get(nodeId);
+            if (proxyInstance != null) {
+                return proxyInstance;
+            }
+            return proxyInstances.computeIfAbsent(nodeId, id -> (T) Proxy.newProxyInstance(
+                type.getClassLoader(),
+                new Class[]{type},
+                new ProxyInvocationHandler(type, MESSAGE_PREFIX,
+                    o -> new SyncOperationHandler(o, nodeId, serializer),
+                    o -> new AsyncOperationHandler(o, nodeId, serializer))));
+        }
+    }
+
+    /**
+     * Implementation of the operation service which handles synchronous method calls.
+     */
+    private class SyncOperationService
+        extends OperationService
+        implements Function<Object[], Object> {
+        SyncOperationService(
+            Object instance,
+            Method method,
+            Operation operation,
+            Serializer serializer,
+            Executor executor) {
+            super(instance, method, operation);
+            clusterCommunicator.addSubscriber(
+                operation.subject(), serializer::decode, this, serializer::encode, executor);
+        }
+
+        @Override
+        public Object apply(Object[] args) {
+            return invoke(args);
+        }
+
+        @Override
+        void close() {
+            clusterCommunicator.removeSubscriber(operation.subject());
+        }
+    }
+
+    /**
+     * Implementation of the operation service which handles asynchronous method calls.
+     */
+    private class AsyncOperationService
+        extends OperationService
+        implements Function<Object[], CompletableFuture<Object>> {
+        AsyncOperationService(Object instance, Method method, Operation operation, Serializer serializer) {
+            super(instance, method, operation);
+            clusterCommunicator.addSubscriber(
+                operation.subject(), serializer::decode, this, serializer::encode);
+        }
+
+        @Override
+        public CompletableFuture<Object> apply(Object[] args) {
+            return invoke(args);
+        }
+
+        @Override
+        void close() {
+            clusterCommunicator.removeSubscriber(operation.subject());
+        }
+    }
+
+    /**
+     * Handler for synchronous proxy operations which blocks on {@code ClusterCommunicationService} requests.
+     */
+    private class SyncOperationHandler extends OperationHandler {
+        private final NodeId nodeId;
+        private final Serializer serializer;
+
+        SyncOperationHandler(Operation operation, NodeId nodeId, Serializer serializer) {
+            super(operation);
+            this.nodeId = nodeId;
+            this.serializer = serializer;
+        }
+
+        @Override
+        public Object apply(Object[] args) {
+            try {
+                return clusterCommunicator.sendAndReceive(
+                    args, operation.subject(), serializer::encode, serializer::decode, nodeId)
+                    .join();
+            } catch (CompletionException e) {
+                if (e.getCause() instanceof RuntimeException) {
+                    throw (RuntimeException) e.getCause();
+                } else {
+                    throw new IllegalStateException(e.getCause());
+                }
+            }
+        }
+    }
+
+    /**
+     * Handler for asynchronous proxy operations which uses async {@code ClusterCommunicationService} requests.
+     */
+    private class AsyncOperationHandler extends OperationHandler {
+        private final NodeId nodeId;
+        private final Serializer serializer;
+
+        AsyncOperationHandler(Operation operation, NodeId nodeId, Serializer serializer) {
+            super(operation);
+            this.nodeId = nodeId;
+            this.serializer = serializer;
+        }
+
+        @Override
+        public Object apply(Object[] args) {
+            return clusterCommunicator.sendAndReceive(
+                args, operation.subject(), serializer::encode, serializer::decode, nodeId);
+        }
+    }
+}
diff --git a/core/net/src/test/java/org/onosproject/cluster/impl/ProxyManagerTest.java b/core/net/src/test/java/org/onosproject/cluster/impl/ProxyManagerTest.java
new file mode 100644
index 0000000..0185c0d
--- /dev/null
+++ b/core/net/src/test/java/org/onosproject/cluster/impl/ProxyManagerTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed 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.onosproject.cluster.impl;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.Test;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.cluster.ProxyFactory;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.Serializer;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Proxy manager test.
+ */
+public class ProxyManagerTest {
+    @Test
+    public void testProxyManager() throws Exception {
+        TestClusterCommunicationServiceFactory clusterCommunicatorFactory =
+            new TestClusterCommunicationServiceFactory();
+
+        NodeId a = NodeId.nodeId("a");
+        NodeId b = NodeId.nodeId("b");
+
+        Serializer serializer = Serializer.using(KryoNamespaces.BASIC);
+
+        ProxyInterfaceImpl proxyInterface1 = new ProxyInterfaceImpl();
+        ProxyManager proxyManager1 = new ProxyManager();
+        proxyManager1.clusterCommunicator = clusterCommunicatorFactory.newCommunicationService(a);
+        proxyManager1.activate();
+        proxyManager1.registerProxyService(ProxyInterface.class, proxyInterface1, serializer);
+
+        ProxyInterfaceImpl proxyInterface2 = new ProxyInterfaceImpl();
+        ProxyManager proxyManager2 = new ProxyManager();
+        proxyManager2.clusterCommunicator = clusterCommunicatorFactory.newCommunicationService(b);
+        proxyManager2.activate();
+        proxyManager2.registerProxyService(ProxyInterface.class, proxyInterface2, serializer);
+
+        ProxyFactory<ProxyInterface> proxyFactory1 = proxyManager1.getProxyFactory(ProxyInterface.class, serializer);
+        assertEquals("Hello world!", proxyFactory1.getProxyFor(b).sync("Hello world!"));
+        assertEquals(1, proxyInterface2.syncCalls.get());
+        assertEquals("Hello world!", proxyFactory1.getProxyFor(b).async("Hello world!").join());
+        assertEquals(1, proxyInterface2.asyncCalls.get());
+
+        ProxyFactory<ProxyInterface> proxyFactory2 = proxyManager2.getProxyFactory(ProxyInterface.class, serializer);
+        assertEquals("Hello world!", proxyFactory2.getProxyFor(b).sync("Hello world!"));
+        assertEquals(2, proxyInterface2.syncCalls.get());
+        assertEquals("Hello world!", proxyFactory2.getProxyFor(b).async("Hello world!").join());
+        assertEquals(2, proxyInterface2.asyncCalls.get());
+
+        proxyManager1.deactivate();
+        proxyManager2.deactivate();
+    }
+
+    interface ProxyInterface {
+        String sync(String arg);
+        CompletableFuture<String> async(String arg);
+    }
+
+    class ProxyInterfaceImpl implements ProxyInterface {
+        private final AtomicInteger syncCalls = new AtomicInteger();
+        private final AtomicInteger asyncCalls = new AtomicInteger();
+
+        @Override
+        public String sync(String arg) {
+            syncCalls.incrementAndGet();
+            return arg;
+        }
+
+        @Override
+        public CompletableFuture<String> async(String arg) {
+            asyncCalls.incrementAndGet();
+            return CompletableFuture.completedFuture(arg);
+        }
+    }
+}
diff --git a/core/net/src/test/java/org/onosproject/cluster/impl/TestClusterCommunicationService.java b/core/net/src/test/java/org/onosproject/cluster/impl/TestClusterCommunicationService.java
new file mode 100644
index 0000000..680ddd0
--- /dev/null
+++ b/core/net/src/test/java/org/onosproject/cluster/impl/TestClusterCommunicationService.java
@@ -0,0 +1,178 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed 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.onosproject.cluster.impl;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.function.Consumer;
+import java.util.function.Function;
+
+import com.google.common.collect.Maps;
+import org.onlab.util.Tools;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
+import org.onosproject.store.cluster.messaging.ClusterMessageHandler;
+import org.onosproject.store.cluster.messaging.MessageSubject;
+import org.onosproject.store.cluster.messaging.MessagingException;
+
+/**
+ * Cluster communication service implementation used for testing.
+ */
+public class TestClusterCommunicationService implements ClusterCommunicationService {
+    private final NodeId localNodeId;
+    private final Map<NodeId, TestClusterCommunicationService> nodes;
+    private final Map<MessageSubject, Function<byte[], CompletableFuture<byte[]>>> subscribers =
+            Maps.newConcurrentMap();
+
+    public TestClusterCommunicationService(NodeId localNodeId, Map<NodeId, TestClusterCommunicationService> nodes) {
+        this.localNodeId = localNodeId;
+        this.nodes = nodes;
+        nodes.put(localNodeId, this);
+    }
+
+    @Override
+    public <M> void broadcast(M message, MessageSubject subject, Function<M, byte[]> encoder) {
+        nodes.forEach((nodeId, node) -> {
+            if (!nodeId.equals(localNodeId)) {
+                node.handle(subject, encoder.apply(message));
+            }
+        });
+    }
+
+    @Override
+    public <M> void broadcastIncludeSelf(M message, MessageSubject subject, Function<M, byte[]> encoder) {
+        nodes.values().forEach(node -> node.handle(subject, encoder.apply(message)));
+    }
+
+    @Override
+    public <M> CompletableFuture<Void> unicast(
+            M message, MessageSubject subject, Function<M, byte[]> encoder, NodeId toNodeId) {
+        TestClusterCommunicationService node = nodes.get(toNodeId);
+        if (node != null) {
+            node.handle(subject, encoder.apply(message));
+        }
+        return CompletableFuture.completedFuture(null);
+    }
+
+    @Override
+    public <M> void multicast(M message, MessageSubject subject, Function<M, byte[]> encoder, Set<NodeId> nodeIds) {
+        nodes.entrySet().stream()
+                .filter(e -> nodeIds.contains(e.getKey()))
+                .forEach(e -> e.getValue().handle(subject, encoder.apply(message)));
+    }
+
+    @Override
+    public <M, R> CompletableFuture<R> sendAndReceive(
+            M message,
+            MessageSubject subject,
+            Function<M, byte[]> encoder,
+            Function<byte[], R> decoder,
+            NodeId toNodeId) {
+        TestClusterCommunicationService node = nodes.get(toNodeId);
+        if (node == null) {
+            return Tools.exceptionalFuture(new MessagingException.NoRemoteHandler());
+        }
+        return node.handle(subject, encoder.apply(message)).thenApply(decoder);
+    }
+
+    private CompletableFuture<byte[]> handle(MessageSubject subject, byte[] message) {
+        Function<byte[], CompletableFuture<byte[]>> subscriber = subscribers.get(subject);
+        if (subscriber != null) {
+            return subscriber.apply(message);
+        }
+        return Tools.exceptionalFuture(new MessagingException.NoRemoteHandler());
+    }
+
+    private boolean isSubscriber(MessageSubject subject) {
+        return subscribers.containsKey(subject);
+    }
+
+    @Override
+    public <M, R> void addSubscriber(
+            MessageSubject subject,
+            Function<byte[], M> decoder,
+            Function<M, R> handler,
+            Function<R, byte[]> encoder,
+            Executor executor) {
+        subscribers.put(subject, message -> {
+            CompletableFuture<byte[]> future = new CompletableFuture<>();
+            executor.execute(() -> {
+                try {
+                    future.complete(encoder.apply(handler.apply(decoder.apply(message))));
+                } catch (Exception e) {
+                    future.completeExceptionally(new MessagingException.RemoteHandlerFailure());
+                }
+            });
+            return future;
+        });
+    }
+
+    @Override
+    public <M, R> void addSubscriber(
+            MessageSubject subject,
+            Function<byte[], M> decoder,
+            Function<M, CompletableFuture<R>> handler,
+            Function<R, byte[]> encoder) {
+        subscribers.put(subject, message -> {
+            CompletableFuture<byte[]> future = new CompletableFuture<>();
+            try {
+                handler.apply(decoder.apply(message)).whenComplete((result, error) -> {
+                    if (error == null) {
+                        future.complete(encoder.apply(result));
+                    } else {
+                        future.completeExceptionally(new MessagingException.RemoteHandlerFailure());
+                    }
+                });
+            } catch (Exception e) {
+                future.completeExceptionally(new MessagingException.RemoteHandlerFailure());
+            }
+            return future;
+        });
+    }
+
+    @Override
+    public <M> void addSubscriber(
+            MessageSubject subject,
+            Function<byte[], M> decoder,
+            Consumer<M> handler,
+            Executor executor) {
+        subscribers.put(subject, message -> {
+            CompletableFuture<byte[]> future = new CompletableFuture<>();
+            executor.execute(() -> {
+                try {
+                    handler.accept(decoder.apply(message));
+                    future.complete(null);
+                } catch (Exception e) {
+                    future.completeExceptionally(new MessagingException.RemoteHandlerFailure());
+                }
+            });
+            return future;
+        });
+    }
+
+    @Override
+    public void removeSubscriber(MessageSubject subject) {
+        subscribers.remove(subject);
+    }
+
+    @Override
+    public void addSubscriber(MessageSubject subject, ClusterMessageHandler subscriber, ExecutorService executor) {
+        throw new UnsupportedOperationException();
+    }
+}
diff --git a/core/net/src/test/java/org/onosproject/cluster/impl/TestClusterCommunicationServiceFactory.java b/core/net/src/test/java/org/onosproject/cluster/impl/TestClusterCommunicationServiceFactory.java
new file mode 100644
index 0000000..1205506
--- /dev/null
+++ b/core/net/src/test/java/org/onosproject/cluster/impl/TestClusterCommunicationServiceFactory.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed 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.onosproject.cluster.impl;
+
+import java.util.Map;
+
+import com.google.common.collect.Maps;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
+
+/**
+ * Test cluster communication service factory.
+ */
+public class TestClusterCommunicationServiceFactory {
+    private final Map<NodeId, TestClusterCommunicationService> nodes = Maps.newConcurrentMap();
+
+    /**
+     * Creates a new cluster communication service for the given node.
+     *
+     * @param localNodeId the node for which to create the service
+     * @return the communication service for the given node
+     */
+    public ClusterCommunicationService newCommunicationService(NodeId localNodeId) {
+        return new TestClusterCommunicationService(localNodeId, nodes);
+    }
+}
