Fix introduction after one was declined

When we received a remote decline we always went into the REMOTE_DECLINED state
while there's two cases where we need to go into the START state instead.
So when the new request arrived, we weren't in START and thus aborted the protocol.
This commit fixes this.

Fixes #1516
This commit is contained in:
Torsten Grote
2019-03-26 15:59:26 -03:00
parent f9dfbe3fa5
commit 3b4a92f66c
2 changed files with 52 additions and 4 deletions

View File

@@ -405,6 +405,51 @@ public class IntroductionIntegrationTest
assertFalse(listener2.aborted);
}
@Test
public void testNewIntroductionAfterDecline() throws Exception {
addListeners(false, true);
// make introduction
long time = clock.currentTimeMillis();
introductionManager0
.makeIntroduction(contact1From0, contact2From0, null, time);
// sync request messages
sync0To1(1, true);
sync0To2(1, true);
eventWaiter.await(TIMEOUT, 2);
// sync first response
sync1To0(1, true);
eventWaiter.await(TIMEOUT, 1);
// sync second response
sync2To0(1, true);
eventWaiter.await(TIMEOUT, 1);
// sync both forwarded response
sync0To2(1, true);
sync0To1(1, true);
eventWaiter.await(TIMEOUT, 1);
assertFalse(listener0.aborted);
assertFalse(listener1.aborted);
assertFalse(listener2.aborted);
time = clock.currentTimeMillis();
introductionManager0
.makeIntroduction(contact1From0, contact2From0, null, time);
// sync request messages
sync0To1(1, true);
sync0To2(1, true);
eventWaiter.await(TIMEOUT, 2);
assertFalse(listener0.aborted);
assertFalse(listener1.aborted);
assertFalse(listener2.aborted);
}
@Test
public void testResponseAndAuthInOneSync() throws Exception {
addListeners(true, true);