@Test
  public void testLowerCaseOfResolvedServices() throws Exception {
    configFile =
        createTempFileFromResource(
            "org/kaazing/gateway/server/context/parse/data/gateway-config-mixedcase.xml");
    GatewayConfigDocument doc = parser.parse(configFile);
    GatewayContext ctx = resolver.resolve(doc);

    Collection<? extends ServiceContext> services = ctx.getServices();
    for (ServiceContext service : services) {
      // validate that the accepts have lower-case host names
      Collection<String> acceptURIs = service.getAccepts();
      for (String acceptURI : acceptURIs) {
        Assert.assertTrue(
            URIUtils.getHost(acceptURI).equals(URIUtils.getHost(acceptURI).toLowerCase()));
      }

      // validate that the cross-site-constraints have lower-case host names
      Map<String, ? extends Map<String, ? extends CrossSiteConstraintContext>>
          crossSiteConstraints = service.getCrossSiteConstraints();
      for (String key : crossSiteConstraints.keySet()) {
        Map<String, ? extends CrossSiteConstraintContext> crossSiteConstraintsByURI =
            crossSiteConstraints.get(key);
        for (CrossSiteConstraintContext crossSiteConstraint : crossSiteConstraintsByURI.values()) {
          String allowOrigin = crossSiteConstraint.getAllowOrigin();
          if (!"*".equals(allowOrigin)) {
            URI originURI = URI.create(allowOrigin);
            Assert.assertTrue(originURI.getHost().equals(originURI.getHost().toLowerCase()));
          }
        }
      }
    }
  }
 public MonitoredServiceImpl(ServiceContext serviceContext) {
   this.serviceName = serviceContext.getServiceName();
 }
 @Override
 public void start() throws Exception {
   serviceContext.bind(serviceContext.getAccepts(), handler);
 }