prefs1.put(ServiceContainerConfigurationConstants.MBEANSERVER_NAME, "commstreamtest1");
prefs1.put(ServiceContainerConfigurationConstants.CMDSERVICE_DIRECTORY_DYNAMIC_DISCOVERY, "false");
serviceContainer1 = new ServiceContainer();
try {
serviceContainer1.start(prefs1, new ClientCommandSenderConfiguration());
} catch (Exception e) {
throw new Exception("Failed to bind server socket to 127.0.0.1:" + CommTestConstants.CONNECTOR_BIND_PORT, e);
}
// setup the server #2
Preferences prefs2 = getPrefs1();
prefs2.put(ServiceContainerConfigurationConstants.CONNECTOR_TRANSPORT, "socket");
prefs2.put(ServiceContainerConfigurationConstants.CONNECTOR_BIND_ADDRESS, "127.0.0.1");
prefs2.put(ServiceContainerConfigurationConstants.CONNECTOR_BIND_PORT, CommTestConstants.CONNECTOR2_BIND_PORT);
prefs2.put(ServiceContainerConfigurationConstants.CONFIG_SCHEMA_VERSION, ""
+ ServiceContainerConfigurationConstants.CURRENT_CONFIG_SCHEMA_VERSION);
prefs2.put(ServiceContainerConfigurationConstants.DATA_DIRECTORY, "target/data2");
prefs2.put(ServiceContainerConfigurationConstants.MBEANSERVER_NAME, "commstreamtest2");
prefs2.put(ServiceContainerConfigurationConstants.CMDSERVICE_DIRECTORY_DYNAMIC_DISCOVERY, "false");
serviceContainer2 = new ServiceContainer();
try {
serviceContainer2.start(prefs2, new ClientCommandSenderConfiguration());
} catch (BindException e) {
throw new Exception("Failed to bind server socket to 127.0.0.1:" + CommTestConstants.CONNECTOR2_BIND_PORT, e);
}
Thread.sleep(5000);
// install our streaming pojo in our server #2
pojoImpl = new CommTestStreamPojo(this);
serviceContainer2.addRemotePojo(pojoImpl, ICommTestStreamPojo.class);
// setup the client to server #2
RemoteCommunicator comm = new JBossRemotingRemoteCommunicator("socket://127.0.0.1:" +
CommTestConstants.CONNECTOR2_BIND_PORT + "/?force_remote=true");
ClientCommandSenderConfiguration config = new ClientCommandSenderConfiguration();
config.maxConcurrent = Integer.MAX_VALUE; // let the sender send as fast as it can
config.defaultTimeoutMillis = 60000L;
config.commandSpoolFileName = null;
config.enableQueueThrottling = false;
config.enableSendThrottling = false;