*/
@Test
public void testOutboundConnections() throws Exception {
final int outboundSocketBindingPort = 6799;
final int socketBindingPort = 1234;
KernelServices services = installInController(new AdditionalInitialization(){
@Override
protected void setupController(ControllerInitializer controllerInitializer) {
controllerInitializer.addSocketBinding("test", socketBindingPort);
controllerInitializer.addRemoteOutboundSocketBinding("dummy-outbound-socket", "localhost", outboundSocketBindingPort);
controllerInitializer.addRemoteOutboundSocketBinding("other-outbound-socket", "localhost", outboundSocketBindingPort);
}
},readResource("remoting-with-outbound-connections.xml"));
ServiceController<?> endPointService = services.getContainer().getRequiredService(RemotingServices.SUBSYSTEM_ENDPOINT);
assertNotNull("Endpoint service was null", endPointService);
final String remoteOutboundConnectionName = "remote-conn1";
ServiceName remoteOutboundConnectionServiceName = RemoteOutboundConnectionService.REMOTE_OUTBOUND_CONNECTION_BASE_SERVICE_NAME.append(remoteOutboundConnectionName);
ServiceController<?> remoteOutboundConnectionService = services.getContainer().getRequiredService(remoteOutboundConnectionServiceName);
assertNotNull("Remote outbound connection service for outbound connection:" + remoteOutboundConnectionName + " was null", remoteOutboundConnectionService);
RemoteOutboundConnectionService remoteService = (RemoteOutboundConnectionService) remoteOutboundConnectionService.getService();
assertEquals(2, remoteService.connectionCreationOptions.size());
final String localOutboundConnectionName = "local-conn1";
ServiceName localOutboundConnectionServiceName = LocalOutboundConnectionService.LOCAL_OUTBOUND_CONNECTION_BASE_SERVICE_NAME.append(localOutboundConnectionName);
ServiceController<?> localOutboundConnectionService = services.getContainer().getRequiredService(localOutboundConnectionServiceName);
assertNotNull("Local outbound connection service for outbound connection:" + localOutboundConnectionName + " was null", localOutboundConnectionService);
LocalOutboundConnectionService localService = (LocalOutboundConnectionService)localOutboundConnectionService.getService();
assertEquals(2, localService.connectionCreationOptions.size());
}