@After
 public void tearDown() {
   for (ServiceRegistration<?> serviceRegistration : serviceRegistrations) {
     try {
       serviceRegistration.unregister();
     } catch (IllegalStateException e) {
       // Service was already unregistered.
     }
   }
 }
 protected void unregisterService(Object service) {
   for (ServiceRegistration<?> serviceRegistration : serviceRegistrations)
     if (getSystemBundleContext().getService(serviceRegistration.getReference()).equals(service))
       serviceRegistration.unregister();
 }