Only allow new introductions in START state

When the user attempts an introduction, instead of the introduction
message input field, an explanatory text will be shown and the
introduction can not be made until the last one has been finished.
This commit is contained in:
Torsten Grote
2018-04-25 12:05:15 -03:00
parent 94a6137a42
commit b291fcd2cd
6 changed files with 88 additions and 13 deletions

View File

@@ -23,6 +23,7 @@ import org.briarproject.bramble.api.sync.Group;
import org.briarproject.bramble.api.sync.Message;
import org.briarproject.bramble.api.sync.MessageId;
import org.briarproject.bramble.test.TestDatabaseModule;
import org.briarproject.briar.api.client.ProtocolStateException;
import org.briarproject.briar.api.client.SessionId;
import org.briarproject.briar.api.introduction.IntroductionManager;
import org.briarproject.briar.api.introduction.IntroductionMessage;
@@ -446,6 +447,26 @@ public class IntroductionIntegrationTest
assertFalse(listener2.aborted);
}
@Test(expected = ProtocolStateException.class)
public void testDoubleIntroduction() throws Exception {
// we can make an introduction
assertTrue(introductionManager0
.canIntroduce(contact1From0, contact2From0));
// make the introduction
long time = clock.currentTimeMillis();
introductionManager0
.makeIntroduction(contact1From0, contact2From0, null, time);
// no more introduction allowed while the existing one is in progress
assertFalse(introductionManager0
.canIntroduce(contact1From0, contact2From0));
// try it anyway and fail
introductionManager0
.makeIntroduction(contact1From0, contact2From0, null, time);
}
@Test
public void testIntroducerRemovedCleanup() throws Exception {
addListeners(true, true);