AstrixContextImpl implements Astrix, AstrixApplicationContext { @Override public void startServicePublisher() { if (!isServer()) { throw new IllegalStateException("Server part not configured. Set AstrixConfigurer.setApplicationDescriptor to load server part of framework"); } ServiceExporter serviceExporter = getInstance(ServiceExporter.class); if (config.get(AstrixSettings.SERVICE_ADMINISTRATOR_EXPORTED).get()) { exportServiceAdministrator(serviceExporter); } else { log.info("Export of ServiceAdministrator service explicitly disabled. Won't export ServiceAdministrator service."); } serviceExporter.startPublishServices(); } AstrixContextImpl(Modules modules, AstrixApplicationDescriptor applicationDescriptor); @Override void destroy(); @Override void close(); BeanConfiguration getBeanConfiguration(AstrixBeanKey<?> beanKey); @Override T getBean(Class<T> beanType); @Override T getBean(Class<T> beanType, String qualifier); T getBean(AstrixBeanKey<T> beanKey); @Override T waitForBean(Class<T> beanType, long timeoutMillis); @Override T waitForBean(Class<T> beanType, String qualifier, long timeoutMillis); final T getInstance(final Class<T> classType); @Override void startServicePublisher();  }
@Test(expected=IllegalStateException.class) public void throwsIllegalStateExceptionWhenStartingServicePublisherForNonServer() throws Exception { TestAstrixConfigurer AstrixConfigurer = new TestAstrixConfigurer(); AstrixApplicationContext context = (AstrixApplicationContext) AstrixConfigurer.configure(); context.startServicePublisher(); }