Source:
private static void serverTearDown(final ModelControllerClient client) throws Exception { ModelNode operation = createOpNode("socket-binding-group=standard-sockets/socket-binding=management-http", ModelDescriptionConstants.READ_RESOURCE_OPERATION); ModelNode response = client.execute(operation); if (response.hasDefined(OUTCOME) && FAILED.equals(response.get(OUTCOME).asString())) { operation = createOpNode("socket-binding-group=standard-sockets/socket-binding=management-http", ModelDescriptionConstants.ADD); operation.get("port").set(MANAGEMENT_HTTP_PORT); operation.get("interface").set("management"); CoreUtils.applyUpdate(operation, client); } operation = createOpNode("core-service=management/management-interface=http-interface", ModelDescriptionConstants.READ_RESOURCE_OPERATION); response = client.execute(operation); if (response.hasDefined(OUTCOME) && FAILED.equals(response.get(OUTCOME).asString())) { operation = createOpNode("core-service=management/management-interface=http-interface", ModelDescriptionConstants.ADD); operation.get("security-realm").set("ManagementRealm"); operation.get("socket-binding").set("management-http"); operation.get("http-upgrade-enabled").set(true); CoreUtils.applyUpdate(operation, client); } LOGGER.info("*** reloading server"); reloadServer(); operation = createOpNode("core-service=management/management-interface=native-interface", ModelDescriptionConstants.REMOVE); CoreUtils.applyUpdate(operation, client); operation = createOpNode("socket-binding-group=standard-sockets/socket-binding=management-native", ModelDescriptionConstants.REMOVE); CoreUtils.applyUpdate(operation, client); }

Target:
private static void serverTearDown(final ModelControllerClient client) throws Exception { ModelNode operation = createOpNode("socket-binding-group=standard-sockets/socket-binding=management-http", ModelDescriptionConstants.READ_RESOURCE_OPERATION); ModelNode response = client.execute(operation); if (response.hasDefined(OUTCOME) && FAILED.equals(response.get(OUTCOME).asString())) { operation = createOpNode("socket-binding-group=standard-sockets/socket-binding=management-http", ModelDescriptionConstants.ADD); operation.get("port").set(MANAGEMENT_HTTP_PORT); operation.get("interface").set("management"); CoreUtils.applyUpdate(operation, client); } operation = createOpNode("core-service=management/management-interface=http-interface", ModelDescriptionConstants.READ_RESOURCE_OPERATION); response = client.execute(operation); if (response.hasDefined(OUTCOME) && FAILED.equals(response.get(OUTCOME).asString())) { operation = createOpNode("core-service=management/management-interface=http-interface", ModelDescriptionConstants.ADD); operation.get("security-realm").set("ManagementRealm"); operation.get("socket-binding").set("management-http"); operation.get("http-upgrade-enabled").set(true); CoreUtils.applyUpdate(operation, client); } reloadServer(); operation = createOpNode("core-service=management/management-interface=native-interface", ModelDescriptionConstants.REMOVE); CoreUtils.applyUpdate(operation, client); operation = createOpNode("socket-binding-group=standard-sockets/socket-binding=management-native", ModelDescriptionConstants.REMOVE); CoreUtils.applyUpdate(operation, client); }