Use strings rather than hashes to identify transports. Dev task #64.

This commit is contained in:
akwizgran
2014-01-24 10:39:34 +00:00
parent 468db2a97b
commit 822392f9e7
26 changed files with 115 additions and 172 deletions

View File

@@ -5,6 +5,7 @@ import static org.briarproject.api.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
import static org.briarproject.api.AuthorConstants.MAX_SIGNATURE_LENGTH;
import static org.briarproject.api.TransportPropertyConstants.MAX_PROPERTIES_PER_TRANSPORT;
import static org.briarproject.api.TransportPropertyConstants.MAX_PROPERTY_LENGTH;
import static org.briarproject.api.TransportPropertyConstants.MAX_TRANSPORT_ID_LENGTH;
import static org.briarproject.api.messaging.MessagingConstants.MAX_BODY_LENGTH;
import static org.briarproject.api.messaging.MessagingConstants.MAX_CONTENT_TYPE_LENGTH;
import static org.briarproject.api.messaging.MessagingConstants.MAX_GROUP_NAME_LENGTH;
@@ -174,7 +175,8 @@ public class ConstantsTest extends BriarTestCase {
p.put(key, value);
}
// Create a maximum-length transport update
TransportId id = new TransportId(TestUtils.getRandomId());
String idString = TestUtils.createRandomString(MAX_TRANSPORT_ID_LENGTH);
TransportId id = new TransportId(idString);
TransportUpdate u = new TransportUpdate(id, p, Long.MAX_VALUE);
// Serialise the update
ByteArrayOutputStream out = new ByteArrayOutputStream();

View File

@@ -76,7 +76,7 @@ public class OutgoingSimplexConnectionTest extends BriarTestCase {
packetWriterFactory = i.getInstance(PacketWriterFactory.class);
contactId = new ContactId(234);
messageId = new MessageId(TestUtils.getRandomId());
transportId = new TransportId(TestUtils.getRandomId());
transportId = new TransportId("id");
secret = new byte[32];
new Random().nextBytes(secret);
}

View File

@@ -69,7 +69,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
public SimplexMessagingIntegrationTest() throws Exception {
GroupId groupId = new GroupId(TestUtils.getRandomId());
group = new Group(groupId, "Group", new byte[GROUP_SALT_LENGTH]);
transportId = new TransportId(TestUtils.getRandomId());
transportId = new TransportId("id");
// Create matching secrets for Alice and Bob
initialSecret = new byte[32];
new Random().nextBytes(initialSecret);