public void testFIFODeliverySubCloseSubRace() throws Exception {
ServerConfiguration conf = new ServerConfiguration();
ByteString topic = ByteString.copyFromUtf8("subRaceTopic");
ByteString subscriber = ByteString.copyFromUtf8("subRaceSubscriber");
PersistenceManager pm = new StubPersistenceManager();
FIFODeliveryManager fdm = new FIFODeliveryManager(pm, conf);
ExecutorDeliveryEndPointWithQueue dep = new ExecutorDeliveryEndPointWithQueue();
SubscriptionPreferences prefs = SubscriptionPreferences.newBuilder().build();
PipelineFilter filter = new PipelineFilter();
filter.addLast(new AllToAllTopologyFilter());
filter.initialize(conf.getConf());
filter.setSubscriptionPreferences(topic, subscriber, prefs);
MessageSeqId startId = MessageSeqId.newBuilder().setLocalComponent(1).build();
CountDownLatch l = new CountDownLatch(1);
Message m = Message.newBuilder().setBody(ByteString.copyFromUtf8(String.valueOf(1))).build();
TestCallback cb = new TestCallback(l);
pm.persistMessage(new PersistRequest(topic, m, cb, null));
assertTrue("Persistence never finished", l.await(10, TimeUnit.SECONDS));
final CountDownLatch oplatch = new CountDownLatch(3);
fdm.start();
fdm.startServingSubscription(topic, subscriber, prefs, startId, dep, filter,