Index: trunk/objectmq/.classpath
===================================================================
--- trunk/objectmq/.classpath	(revision 26)
+++ trunk/objectmq/.classpath	(revision 27)
@@ -2,4 +2,5 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="test"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 	<classpathentry kind="lib" path="lib/gson-2.2.3.jar"/>
Index: trunk/objectmq/src/omq/common/broker/Broker.java
===================================================================
--- trunk/objectmq/src/omq/common/broker/Broker.java	(revision 26)
+++ trunk/objectmq/src/omq/common/broker/Broker.java	(revision 27)
@@ -23,7 +23,7 @@
 import com.rabbitmq.client.Connection;
 import com.rabbitmq.client.QueueingConsumer;
+import com.rabbitmq.client.QueueingConsumer.Delivery;
 import com.rabbitmq.client.ShutdownListener;
 import com.rabbitmq.client.ShutdownSignalException;
-import com.rabbitmq.client.QueueingConsumer.Delivery;
 
 public class Broker {
@@ -38,24 +38,6 @@
 			Environment.setEnvironment(env);
 			connection = OmqConnectionFactory.getNewConnection(env);
-			connection.addShutdownListener(new ShutdownListener() {
-				@Override
-				public void shutdownCompleted(ShutdownSignalException cause) {
-					if (connection.isOpen()) {
-						try {
-							connection.close();
-						} catch (IOException e) {
-							e.printStackTrace();
-						}
-					}
-					try {
-						Properties env = Environment.getEnvironment();
-						connection = OmqConnectionFactory.getNewWorkingConnection(env);
-						channel = connection.createChannel();
-					} catch (Exception e) {
-						e.printStackTrace();
-					}
-				}
-			});
 			channel = connection.createChannel();
+			addFaultTolerance();
 			try {
 				tryConnection(env);
@@ -165,3 +147,38 @@
 	}
 
+	private static void addFaultTolerance() {
+		connection.addShutdownListener(new ShutdownListener() {
+			@Override
+			public void shutdownCompleted(ShutdownSignalException cause) {
+
+				if (cause.isHardError()) {
+					if (connection.isOpen()) {
+						try {
+							connection.close();
+						} catch (IOException e) {
+							e.printStackTrace();
+						}
+					}
+					try {
+						Properties env = Environment.getEnvironment();
+						connection = OmqConnectionFactory.getNewWorkingConnection(env);
+						channel = connection.createChannel();
+						addFaultTolerance();
+					} catch (Exception e) {
+						e.printStackTrace();
+					}
+				} else {
+					Channel channel = (Channel) cause.getReference();
+					if (channel.isOpen()) {
+						try {
+							channel.close();
+						} catch (IOException e) {
+							e.printStackTrace();
+						}
+					}
+				}
+			}
+		});
+	}
+
 }
Index: trunk/objectmq/src/omq/ztest/calculator/ClientTest.java
===================================================================
--- trunk/objectmq/src/omq/ztest/calculator/ClientTest.java	(revision 26)
+++ trunk/objectmq/src/omq/ztest/calculator/ClientTest.java	(revision 27)
@@ -31,5 +31,5 @@
 		// Set info about where the message will be sent
 		env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange");
-		env.setProperty(ParameterQueue.DEBUGFILE, "c:\\middlewareDebug");
+		// env.setProperty(ParameterQueue.DEBUGFILE, "c:\\middlewareDebug");
 
 		// Set info about the queue & the exchange where the ResponseListener
Index: trunk/objectmq/test/test/Client.java
===================================================================
--- trunk/objectmq/test/test/Client.java	(revision 27)
+++ trunk/objectmq/test/test/Client.java	(revision 27)
@@ -0,0 +1,28 @@
+package test;
+
+import java.util.Set;
+
+import omq.Remote;
+import omq.client.annotation.AsyncMethod;
+import omq.client.annotation.RemoteInterface;
+import omq.client.annotation.SyncMethod;
+import omq.exception.RemoteException;
+
+@RemoteInterface
+public interface Client extends Remote {
+
+	@SyncMethod(retry = 1, timeout = 1500)
+	public String getID();
+
+	@SyncMethod(retry = 1, timeout = 1500)
+	public String getProfileInfo();
+
+	@SyncMethod(retry = 1, timeout = 1500)
+	public Set<String> getFriends();
+
+	@AsyncMethod
+	public void sendMessage(String message);
+
+	@AsyncMethod
+	public void sendContact(String contact) throws RemoteException;
+}
Index: trunk/objectmq/test/test/ClientImpl.java
===================================================================
--- trunk/objectmq/test/test/ClientImpl.java	(revision 27)
+++ trunk/objectmq/test/test/ClientImpl.java	(revision 27)
@@ -0,0 +1,62 @@
+package test;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import omq.client.annotation.AsyncMethod;
+import omq.client.annotation.SyncMethod;
+import omq.common.broker.Broker;
+import omq.exception.RemoteException;
+import omq.server.remote.request.RemoteObject;
+
+public class ClientImpl extends RemoteObject implements Client {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	private String id;
+	private String profileInfo;
+	private Map<String, Client> friendList;
+
+	public ClientImpl(String id, String profileInfo) {
+		this.id = id;
+		this.profileInfo = profileInfo;
+		this.friendList = new HashMap<String, Client>();
+	}
+
+	@Override
+	@SyncMethod(retry = 1, timeout = 1500)
+	public String getID() {
+		return id;
+	}
+
+	@Override
+	@SyncMethod(retry = 1, timeout = 1500)
+	public String getProfileInfo() {
+		return profileInfo;
+	}
+
+	@Override
+	@SyncMethod(retry = 1, timeout = 1500)
+	public Set<String> getFriends() {
+		return friendList.keySet();
+	}
+
+	@Override
+	@AsyncMethod
+	public void sendMessage(String message) {
+		System.out.println("" + message);
+	}
+
+	@Override
+	@AsyncMethod
+	public void sendContact(String contact) throws RemoteException {
+		if (!id.equalsIgnoreCase(contact) && !friendList.containsKey(contact)) {
+			Client client = (Client) Broker.lookup(contact, Client.class);
+			friendList.put(contact, client);
+		}
+	}
+
+}
