@Test
public void testExecute() throws Exception {

	// Test 1, execute multicast request and not skip local
	ClusterExecutorImpl clusterExecutorImpl = getClusterExecutorImpl();
	TestClusterChannel.clearAllMessages();
	List<Serializable> multicastMessages =
		TestClusterChannel.getMulticastMessages();
	List<ObjectValuePair<Serializable, Address>> unicastMessages =
		TestClusterChannel.getUnicastMessages();
	Assert.assertTrue(
		multicastMessages.toString(), multicastMessages.isEmpty());
	Assert.assertTrue(
		unicastMessages.toString(), unicastMessages.isEmpty());
	ClusterRequest clusterRequest = ClusterRequest.createMulticastRequest(
		StringPool.BLANK);
	FutureClusterResponses futureClusterResponses =
		clusterExecutorImpl.execute(clusterRequest);
	Assert.assertEquals(
		multicastMessages.toString(), 1, multicastMessages.size());
	Assert.assertTrue(
		multicastMessages.toString(),
		multicastMessages.contains(clusterRequest));
	Assert.assertTrue(
		unicastMessages.toString(), unicastMessages.isEmpty());
	ClusterNodeResponses clusterNodeResponses =
		futureClusterResponses.get();
	Assert.assertEquals(1, clusterNodeResponses.size());
	// Test 2, execute multicast request and skip local
	TestClusterChannel.clearAllMessages();
	Assert.assertTrue(
		multicastMessages.toString(), multicastMessages.isEmpty());
	Assert.assertTrue(
		unicastMessages.toString(), unicastMessages.isEmpty());
	clusterRequest = ClusterRequest.createMulticastRequest(
		StringPool.BLANK, true);
	futureClusterResponses = clusterExecutorImpl.execute(clusterRequest);
	Assert.assertEquals(
		multicastMessages.toString(), 1, multicastMessages.size());
	Assert.assertTrue(
		multicastMessages.toString(),
		multicastMessages.contains(clusterRequest));
	Assert.assertTrue(
		unicastMessages.toString(), unicastMessages.isEmpty());
	clusterNodeResponses = futureClusterResponses.get();
	Assert.assertEquals(0, clusterNodeResponses.size());
	// Test 3, execute unicast request to local address
	TestClusterChannel.clearAllMessages();
	Assert.assertTrue(
		multicastMessages.toString(), multicastMessages.isEmpty());
	Assert.assertTrue(
		unicastMessages.toString(), unicastMessages.isEmpty());
	ClusterNode localClusterNode =
		clusterExecutorImpl.getLocalClusterNode();
	clusterRequest = ClusterRequest.createUnicastRequest(
		clusterRequest, localClusterNode.getClusterNodeId());
	futureClusterResponses = clusterExecutorImpl.execute(clusterRequest);
	Assert.assertTrue(
		multicastMessages.toString(), multicastMessages.isEmpty());
	Assert.assertTrue(
		unicastMessages.toString(), unicastMessages.isEmpty());
	clusterNodeResponses = futureClusterResponses.get();
	Assert.assertEquals(1, clusterNodeResponses.size());
	// Test 4, execute unicast request to other address
	TestClusterChannel.clearAllMessages();
	Assert.assertTrue(
		multicastMessages.toString(), multicastMessages.isEmpty());
	Assert.assertTrue(
		unicastMessages.toString(), unicastMessages.isEmpty());
	ClusterExecutorImpl newClusterExecutorImpl = getClusterExecutorImpl();
	Assert.assertEquals(
		multicastMessages.toString(), 1, multicastMessages.size());
	Assert.assertTrue(
		unicastMessages.toString(), unicastMessages.isEmpty());
	Serializable serializable = multicastMessages.get(0);
	clusterExecutorImpl.handleReceivedClusterRequest(
		(ClusterRequest)serializable);
	TestClusterChannel.clearAllMessages();
	ClusterNode newClusterNode =
		newClusterExecutorImpl.getLocalClusterNode();
	clusterRequest = ClusterRequest.createUnicastRequest(
		StringPool.BLANK, newClusterNode.getClusterNodeId());
	clusterExecutorImpl.execute(clusterRequest);
	Assert.assertTrue(
		multicastMessages.toString(), multicastMessages.isEmpty());
	Assert.assertEquals(
		unicastMessages.toString(), 1, unicastMessages.size());
	ObjectValuePair<Serializable, Address> receivedMessage =
		unicastMessages.get(0);
	Assert.assertEquals(clusterRequest, receivedMessage.getKey());
}