SiriClientSubscriptionManager implements StatusProviderService { void handleChannelDisconnectAndReconnect(ClientSubscriptionChannel channel) { _log.info("channel disconnect: {}", channel.getAddress()); Set<SubscriptionId> channelSubscriptionIds = new HashSet<SubscriptionId>( channel.getSubscriptions()); List<ClientSubscriptionInstance> instances = new ArrayList<ClientSubscriptionInstance>(); for (SubscriptionId subscriptionId : channelSubscriptionIds) { ClientSubscriptionInstance instance = _activeSubscriptions.get(subscriptionId); if (instance != null) instances.add(instance); } _terminateSubscriptionsManager.requestTerminationOfSubscriptions(instances, true); }  @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);  }
@SuppressWarnings("unchecked") @Test public void testHandleChannelDisconnectAndReconnect() { 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: _manager.upgradePendingSubscription(response, status, subscriptionId, moduleType, originalSubscriptionRequest); ClientSubscriptionChannel channel = new ClientSubscriptionChannel( "http: channel.getSubscriptions().add(subscriptionId); _manager.handleChannelDisconnectAndReconnect(channel); Mockito.verify(_terminateSubscriptionsManager).requestTerminationOfSubscriptions( Mockito.anyList(), Mockito.eq(true)); }