ServiceRegistration reg1 = registry.registerService(im, BarService.class.getName(), new barProvider(), props);
ServiceReference ref = registry.getServiceReference(BarService.class.getName());
assertNotNull("Check ref not null", ref);
assertEquals("Test property", ref.getProperty("foo"), "bar");
BarService bar = (BarService) registry.getService(im2, ref);
assertTrue("Test invocation", bar.bar());
reg1.unregister();
ref = registry.getServiceReference(BarService.class.getName());
assertNull("Check ref null", ref);
}