assert server_metrics2.getNumberFailedCommandsReceived() == 0;
assert server_metrics2.getNumberTotalCommandsReceived() == 0;
assert server_metrics2.getAverageExecutionTimeReceived() == 0;
IdentifyCommand command = new IdentifyCommand();
IdentifyCommandResponse response;
response = (IdentifyCommandResponse) agent1.getClientCommandSender().sendSynch(command);
assert response.isSuccessful() : "Failed to send command from agent1 to agent2";
assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent2
.getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identify of agent2 - what remoting server did we just communicate with??";
assert client_metrics1.getNumberSuccessfulCommandsSent() == 1;
assert client_metrics1.getNumberFailedCommandsSent() == 0;
assert client_metrics2.getNumberSuccessfulCommandsSent() == 0;
assert client_metrics2.getNumberFailedCommandsSent() == 0;
assert server_metrics1.getNumberSuccessfulCommandsReceived() == 0;
assert server_metrics1.getNumberFailedCommandsReceived() == 0;
assert server_metrics1.getNumberTotalCommandsReceived() == 0;
assert server_metrics2.getNumberSuccessfulCommandsReceived() == 1;
assert server_metrics2.getNumberFailedCommandsReceived() == 0;
assert server_metrics2.getNumberTotalCommandsReceived() == 1;
response = (IdentifyCommandResponse) agent1.getClientCommandSender().sendSynch(command);
assert response.isSuccessful() : "Failed to send command from agent1 to agent2";
assert client_metrics1.getNumberSuccessfulCommandsSent() == 2;
assert client_metrics1.getNumberFailedCommandsSent() == 0;
assert client_metrics2.getNumberSuccessfulCommandsSent() == 0;
assert client_metrics2.getNumberFailedCommandsSent() == 0;
assert server_metrics1.getNumberSuccessfulCommandsReceived() == 0;
assert server_metrics1.getNumberFailedCommandsReceived() == 0;
assert server_metrics1.getNumberTotalCommandsReceived() == 0;
assert server_metrics2.getNumberSuccessfulCommandsReceived() == 2;
assert server_metrics2.getNumberFailedCommandsReceived() == 0;
assert server_metrics2.getNumberTotalCommandsReceived() == 2;
response = (IdentifyCommandResponse) agent2.getClientCommandSender().sendSynch(command);
assert response.isSuccessful() : "Failed to send command from agent2 to agent1";
assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent1
.getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identity of agent1 - what remoting server did we just communicate with??";
assert client_metrics1.getNumberSuccessfulCommandsSent() == 2;
assert client_metrics1.getNumberFailedCommandsSent() == 0;
assert client_metrics2.getNumberSuccessfulCommandsSent() == 1;
assert client_metrics2.getNumberFailedCommandsSent() == 0;
assert server_metrics1.getNumberSuccessfulCommandsReceived() == 1;
assert server_metrics1.getNumberFailedCommandsReceived() == 0;
assert server_metrics1.getNumberTotalCommandsReceived() == 1;
assert server_metrics2.getNumberSuccessfulCommandsReceived() == 2;
assert server_metrics2.getNumberFailedCommandsReceived() == 0;
assert server_metrics2.getNumberTotalCommandsReceived() == 2;
response = (IdentifyCommandResponse) agent2.getClientCommandSender().sendSynch(command);
assert response.isSuccessful() : "Failed to send command from agent2 to agent1";
assert client_metrics1.getNumberSuccessfulCommandsSent() == 2;
assert client_metrics1.getNumberFailedCommandsSent() == 0;
assert client_metrics2.getNumberSuccessfulCommandsSent() == 2;
assert client_metrics2.getNumberFailedCommandsSent() == 0;