Source:
private AdditionalInitialization createRuntimeAdditionalInitialization() { return new AdditionalInitialization() { @Override protected void setupController(ControllerInitializer controllerInitializer) { controllerInitializer.addSocketBinding("remoting", 27258); controllerInitializer.addRemoteOutboundSocketBinding("dummy-outbound-socket", "localhost", 6799); controllerInitializer.addRemoteOutboundSocketBinding("other-outbound-socket", "localhost", 1234); } @Override protected void addExtraServices(ServiceTarget target) { AbsolutePathService.addService(ServerEnvironment.CONTROLLER_TEMP_DIR, new File("target/temp" + System.currentTimeMillis()).getAbsolutePath(), target); ServiceBuilder<?> builder = target.addService(IOServices.WORKER.append("default")); Consumer<XnioWorker> workerConsumer = builder.provides(IOServices.WORKER.append("default")); builder.setInstance(new WorkerService(workerConsumer, null, Xnio.getInstance().createWorkerBuilder().setWorkerIoThreads(2))); builder.install(); builder = target.addService(IOServices.WORKER.append("default-remoting")); workerConsumer = builder.provides(IOServices.WORKER.append("default-remoting")); builder.setInstance(new WorkerService(workerConsumer, null, Xnio.getInstance().createWorkerBuilder().setWorkerIoThreads(2))); builder.install(); } @Override protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) { super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry); Map<String, Class> capabilities = new HashMap<>(); capabilities.put(buildDynamicCapabilityName(IO_WORKER_CAPABILITY_NAME, RemotingSubsystemRootResource.WORKER.getDefaultValue().asString()), XnioWorker.class); capabilities.put(buildDynamicCapabilityName(IO_WORKER_CAPABILITY_NAME, "default-remoting"), XnioWorker.class); AdditionalInitialization.registerServiceCapabilities(capabilityRegistry, capabilities); } }; }

Target:
private AdditionalInitialization createRuntimeAdditionalInitialization() { return new AdditionalInitialization() { @Override protected void setupController(ControllerInitializer controllerInitializer) { controllerInitializer.addSocketBinding("remoting", 27258); controllerInitializer.addRemoteOutboundSocketBinding("dummy-outbound-socket", "localhost", 6799); controllerInitializer.addRemoteOutboundSocketBinding("other-outbound-socket", "localhost", 1234); } @Override protected void addExtraServices(ServiceTarget target) { AbsolutePathService.addService(ServerEnvironment.CONTROLLER_TEMP_DIR, new File("target/temp" + System.currentTimeMillis()).getAbsolutePath(), target); ServiceBuilder<?> builder = target.addService(IOServices.WORKER.append("default")); Consumer<XnioWorker> workerConsumer = builder.provides(IOServices.WORKER.append("default")); builder.setInstance(new WorkerService(workerConsumer, () -> Executors.newFixedThreadPool(1), Xnio.getInstance().createWorkerBuilder().setWorkerIoThreads(2))); builder.setInitialMode(ServiceController.Mode.ON_DEMAND); builder.install(); builder = target.addService(IOServices.WORKER.append("default-remoting")); workerConsumer = builder.provides(IOServices.WORKER.append("default-remoting")); builder.setInstance(new WorkerService(workerConsumer, () -> Executors.newFixedThreadPool(1), Xnio.getInstance().createWorkerBuilder().setWorkerIoThreads(2))); builder.setInitialMode(ServiceController.Mode.ON_DEMAND); builder.install(); } @Override protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) { super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry); Map<String, Class> capabilities = new HashMap<>(); capabilities.put(buildDynamicCapabilityName(IO_WORKER_CAPABILITY_NAME, RemotingSubsystemRootResource.WORKER.getDefaultValue().asString()), XnioWorker.class); capabilities.put(buildDynamicCapabilityName(IO_WORKER_CAPABILITY_NAME, "default-remoting"), XnioWorker.class); AdditionalInitialization.registerServiceCapabilities(capabilityRegistry, capabilities); } }; }