SiriClientSubscriptionManager implements StatusProviderService { public SiriChannelInfo getChannelInfoForServiceDelivery( ServiceDelivery serviceDelivery) { SiriChannelInfo channelInfo = new SiriChannelInfo(); Set<ClientSubscriptionChannel> channels = new HashSet<ClientSubscriptionChannel>(); Set<SiriClientRequest> requests = new HashSet<SiriClientRequest>(); String address = serviceDelivery.getAddress(); if (address != null) { ClientSubscriptionChannel channel = _activeChannels.get(address); if (channel != null) { channels.add(channel); } } Set<ClientSubscriptionInstance> instances = getSubscriptionInstancesForServiceDelivery(serviceDelivery); for (ClientSubscriptionInstance instance : instances) { channels.add(instance.getChannel()); requests.add(instance.getRequest()); } channelInfo.setSiriClientRequests(new ArrayList<SiriClientRequest>(requests)); if (!channels.isEmpty()) { if (channels.size() > 1) { _log.warn("multiple channels found for a single service delivery"); } else { ClientSubscriptionChannel channel = channels.iterator().next(); channelInfo.setContext(channel.getContext()); } } return channelInfo; }  @Inject void setSchedulingService(SchedulingService schedulingService); @Inject void setHeartbeatManager(HeartbeatManager heartbeatManager); void registerPendingSubscription(SiriClientRequest request,
      SubscriptionRequest subscriptionRequest); void clearPendingSubscription(SiriClientRequest request,
      SubscriptionRequest subscriptionRequest); void handleSubscriptionResponse(SubscriptionResponseStructure response); boolean isSubscriptionActive(SubscriptionId subscriptionId); boolean isSubscriptionActiveForModuleDelivery(
      AbstractServiceDeliveryStructure moduleDelivery); void recordServiceDeliveryStatistics(ServiceDelivery serviceDelivery); SiriChannelInfo getChannelInfoForServiceDelivery(
      ServiceDelivery serviceDelivery); void handleTerminateSubscriptionResponse(
      TerminateSubscriptionResponseStructure response); void terminateAllSubscriptions(
      boolean waitForTerminateSubscriptionResponseOnExit); void handleCheckStatusNotification(
      CheckStatusResponseStructure response); void handleHeartbeatNotification(
      HeartbeatNotificationStructure heartbeat); @Override void getStatus(Map<String, String> status);  }
@Test public void testGetChannelInfoForServiceDelivery() { SubscriptionResponseStructure response = new SubscriptionResponseStructure(); StatusResponseStructure status = new StatusResponseStructure(); SubscriptionId subscriptionId = new SubscriptionId("subscriberA", "subscriptionB"); ESiriModuleType moduleType = ESiriModuleType.VEHICLE_MONITORING; SiriClientRequest originalSubscriptionRequest = new SiriClientRequest(); originalSubscriptionRequest.setTargetUrl("http: originalSubscriptionRequest.setChannelContext("CONTEXT"); _manager.upgradePendingSubscription(response, status, subscriptionId, moduleType, originalSubscriptionRequest); ServiceDelivery serviceDelivery = new ServiceDelivery(); serviceDelivery.setAddress("http: SiriChannelInfo info = _manager.getChannelInfoForServiceDelivery(serviceDelivery); assertEquals("CONTEXT", info.getContext()); }