@Test
public void testPublishToItself() throws InterruptedException {

    final Subscription subscription = new Subscription(FAKE_CLIENT_ID, new Topic(FAKE_TOPIC), AT_MOST_ONCE);
    // subscriptions.matches(topic) redefine the method to return true
    ISubscriptionsDirectory subs = new CTrieSubscriptionDirectory() {
        @Override
        public List<Subscription> matches(Topic topic) {
            if (topic.toString().equals(FAKE_TOPIC)) {
                return Collections.singletonList(subscription);
            } else {
                throw new IllegalArgumentException("Expected " + FAKE_TOPIC + " buf found " + topic);
            }
        }
    };
    // simulate a connect that register a clientID to an IoSession
    MemoryStorageService storageService = new MemoryStorageService(null, null);
    SessionsRepository sessionsRepository = new SessionsRepository(storageService.sessionsStore(), null);
    subs.init(sessionsRepository);
    m_processor.init(subs, m_messagesStore, m_sessionStore, null, true, new PermitAllAuthorizator(),
            NO_OBSERVERS_INTERCEPTOR, this.sessionsRepository);
    connect_v3_1();
    // Exercise
    publishToAs("FakeCLI", FAKE_TOPIC, AT_MOST_ONCE, false);
    // Verify
    verifyPublishIsReceived();
}