mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Renamed a load of things from 'connection' to 'stream'.
This commit is contained in:
@@ -11,7 +11,6 @@ import org.briarproject.api.crypto.MessageDigest;
|
||||
import org.briarproject.api.serial.CopyingConsumer;
|
||||
import org.briarproject.api.serial.CountingConsumer;
|
||||
import org.briarproject.api.serial.DigestingConsumer;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class ConsumersTest extends BriarTestCase {
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.briarproject.api.serial.SerialComponent;
|
||||
import org.briarproject.api.serial.Writer;
|
||||
import org.briarproject.api.serial.WriterFactory;
|
||||
import org.briarproject.serial.SerialModule;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
|
||||
@@ -3,7 +3,7 @@ package org.briarproject.messaging.simplex;
|
||||
import static org.briarproject.api.messaging.MessagingConstants.MAX_PACKET_LENGTH;
|
||||
import static org.briarproject.api.transport.TransportConstants.HEADER_LENGTH;
|
||||
import static org.briarproject.api.transport.TransportConstants.MAC_LENGTH;
|
||||
import static org.briarproject.api.transport.TransportConstants.MIN_CONNECTION_LENGTH;
|
||||
import static org.briarproject.api.transport.TransportConstants.MIN_STREAM_LENGTH;
|
||||
import static org.briarproject.api.transport.TransportConstants.TAG_LENGTH;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -24,9 +24,9 @@ import org.briarproject.api.db.DatabaseExecutor;
|
||||
import org.briarproject.api.messaging.Ack;
|
||||
import org.briarproject.api.messaging.MessageId;
|
||||
import org.briarproject.api.messaging.PacketWriterFactory;
|
||||
import org.briarproject.api.transport.ConnectionContext;
|
||||
import org.briarproject.api.transport.ConnectionRegistry;
|
||||
import org.briarproject.api.transport.ConnectionWriterFactory;
|
||||
import org.briarproject.api.transport.StreamContext;
|
||||
import org.briarproject.api.transport.StreamWriterFactory;
|
||||
import org.briarproject.crypto.CryptoModule;
|
||||
import org.briarproject.event.EventModule;
|
||||
import org.briarproject.messaging.MessagingModule;
|
||||
@@ -49,7 +49,7 @@ public class OutgoingSimplexConnectionTest extends BriarTestCase {
|
||||
private final Mockery context;
|
||||
private final DatabaseComponent db;
|
||||
private final ConnectionRegistry connRegistry;
|
||||
private final ConnectionWriterFactory connWriterFactory;
|
||||
private final StreamWriterFactory connWriterFactory;
|
||||
private final PacketWriterFactory packetWriterFactory;
|
||||
private final ContactId contactId;
|
||||
private final MessageId messageId;
|
||||
@@ -74,7 +74,7 @@ public class OutgoingSimplexConnectionTest extends BriarTestCase {
|
||||
new DuplexMessagingModule(), new SimplexMessagingModule(),
|
||||
new SerialModule(), new TransportModule());
|
||||
connRegistry = i.getInstance(ConnectionRegistry.class);
|
||||
connWriterFactory = i.getInstance(ConnectionWriterFactory.class);
|
||||
connWriterFactory = i.getInstance(StreamWriterFactory.class);
|
||||
packetWriterFactory = i.getInstance(PacketWriterFactory.class);
|
||||
contactId = new ContactId(234);
|
||||
messageId = new MessageId(TestUtils.getRandomId());
|
||||
@@ -88,7 +88,7 @@ public class OutgoingSimplexConnectionTest extends BriarTestCase {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
TestSimplexTransportWriter transport = new TestSimplexTransportWriter(
|
||||
out, MAX_PACKET_LENGTH, Long.MAX_VALUE);
|
||||
ConnectionContext ctx = new ConnectionContext(contactId, transportId,
|
||||
StreamContext ctx = new StreamContext(contactId, transportId,
|
||||
secret, 0, true);
|
||||
OutgoingSimplexConnection connection = new OutgoingSimplexConnection(db,
|
||||
connRegistry, connWriterFactory, packetWriterFactory, ctx,
|
||||
@@ -105,8 +105,8 @@ public class OutgoingSimplexConnectionTest extends BriarTestCase {
|
||||
public void testNothingToSend() throws Exception {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
TestSimplexTransportWriter transport = new TestSimplexTransportWriter(
|
||||
out, MIN_CONNECTION_LENGTH, Long.MAX_VALUE);
|
||||
ConnectionContext ctx = new ConnectionContext(contactId, transportId,
|
||||
out, MIN_STREAM_LENGTH, Long.MAX_VALUE);
|
||||
StreamContext ctx = new StreamContext(contactId, transportId,
|
||||
secret, 0, true);
|
||||
OutgoingSimplexConnection connection = new OutgoingSimplexConnection(db,
|
||||
connRegistry, connWriterFactory, packetWriterFactory, ctx,
|
||||
@@ -154,8 +154,8 @@ public class OutgoingSimplexConnectionTest extends BriarTestCase {
|
||||
public void testSomethingToSend() throws Exception {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
TestSimplexTransportWriter transport = new TestSimplexTransportWriter(
|
||||
out, MIN_CONNECTION_LENGTH, Long.MAX_VALUE);
|
||||
ConnectionContext ctx = new ConnectionContext(contactId, transportId,
|
||||
out, MIN_STREAM_LENGTH, Long.MAX_VALUE);
|
||||
StreamContext ctx = new StreamContext(contactId, transportId,
|
||||
secret, 0, true);
|
||||
OutgoingSimplexConnection connection = new OutgoingSimplexConnection(db,
|
||||
connRegistry, connWriterFactory, packetWriterFactory, ctx,
|
||||
|
||||
@@ -32,12 +32,12 @@ import org.briarproject.api.messaging.MessageFactory;
|
||||
import org.briarproject.api.messaging.MessageVerifier;
|
||||
import org.briarproject.api.messaging.PacketReaderFactory;
|
||||
import org.briarproject.api.messaging.PacketWriterFactory;
|
||||
import org.briarproject.api.transport.ConnectionContext;
|
||||
import org.briarproject.api.transport.ConnectionReaderFactory;
|
||||
import org.briarproject.api.transport.ConnectionRecogniser;
|
||||
import org.briarproject.api.transport.ConnectionRegistry;
|
||||
import org.briarproject.api.transport.ConnectionWriterFactory;
|
||||
import org.briarproject.api.transport.Endpoint;
|
||||
import org.briarproject.api.transport.StreamContext;
|
||||
import org.briarproject.api.transport.StreamReaderFactory;
|
||||
import org.briarproject.api.transport.StreamWriterFactory;
|
||||
import org.briarproject.api.transport.TagRecogniser;
|
||||
import org.briarproject.crypto.CryptoModule;
|
||||
import org.briarproject.db.DatabaseModule;
|
||||
import org.briarproject.event.EventModule;
|
||||
@@ -144,13 +144,13 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ConnectionRegistry connRegistry =
|
||||
alice.getInstance(ConnectionRegistry.class);
|
||||
ConnectionWriterFactory connWriterFactory =
|
||||
alice.getInstance(ConnectionWriterFactory.class);
|
||||
StreamWriterFactory connWriterFactory =
|
||||
alice.getInstance(StreamWriterFactory.class);
|
||||
PacketWriterFactory packetWriterFactory =
|
||||
alice.getInstance(PacketWriterFactory.class);
|
||||
TestSimplexTransportWriter transport = new TestSimplexTransportWriter(
|
||||
out, Long.MAX_VALUE, Long.MAX_VALUE);
|
||||
ConnectionContext ctx = km.getConnectionContext(contactId, transportId);
|
||||
StreamContext ctx = km.getStreamContext(contactId, transportId);
|
||||
assertNotNull(ctx);
|
||||
OutgoingSimplexConnection simplex = new OutgoingSimplexConnection(db,
|
||||
connRegistry, connWriterFactory, packetWriterFactory, ctx,
|
||||
@@ -196,21 +196,21 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
|
||||
// Set up an event listener
|
||||
MessageListener listener = new MessageListener();
|
||||
bob.getInstance(EventBus.class).addListener(listener);
|
||||
// Create a connection recogniser and recognise the connection
|
||||
// Create a tag recogniser and recognise the tag
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(b);
|
||||
ConnectionRecogniser rec = bob.getInstance(ConnectionRecogniser.class);
|
||||
TagRecogniser rec = bob.getInstance(TagRecogniser.class);
|
||||
byte[] tag = new byte[TAG_LENGTH];
|
||||
int read = in.read(tag);
|
||||
assertEquals(tag.length, read);
|
||||
ConnectionContext ctx = rec.acceptConnection(transportId, tag);
|
||||
StreamContext ctx = rec.recogniseTag(transportId, tag);
|
||||
assertNotNull(ctx);
|
||||
// Create an incoming simplex connection
|
||||
MessageVerifier messageVerifier =
|
||||
bob.getInstance(MessageVerifier.class);
|
||||
ConnectionRegistry connRegistry =
|
||||
bob.getInstance(ConnectionRegistry.class);
|
||||
ConnectionReaderFactory connWriterFactory =
|
||||
bob.getInstance(ConnectionReaderFactory.class);
|
||||
StreamReaderFactory connWriterFactory =
|
||||
bob.getInstance(StreamReaderFactory.class);
|
||||
PacketReaderFactory packetWriterFactory =
|
||||
bob.getInstance(PacketReaderFactory.class);
|
||||
TestSimplexTransportReader transport =
|
||||
|
||||
Reference in New Issue
Block a user