diff --git a/components/net/sf/briar/transport/ConnectionReaderFactoryImpl.java b/components/net/sf/briar/transport/ConnectionReaderFactoryImpl.java
index a2d73e9a3..a2725ef2d 100644
--- a/components/net/sf/briar/transport/ConnectionReaderFactoryImpl.java
+++ b/components/net/sf/briar/transport/ConnectionReaderFactoryImpl.java
@@ -55,7 +55,8 @@ class ConnectionReaderFactoryImpl implements ConnectionReaderFactory {
new IncomingAuthenticationLayerImpl(correction, mac, macKey);
// No reordering or retransmission
IncomingReliabilityLayer reliability =
- new NullIncomingReliabilityLayer(authentication);
+ new IncomingReliabilityLayerImpl(authentication,
+ new NullFrameWindow());
// Create the reader - don't tolerate errors
return new ConnectionReaderImpl(reliability, false);
}
@@ -81,7 +82,7 @@ class ConnectionReaderFactoryImpl implements ConnectionReaderFactory {
Cipher tagCipher = crypto.getTagCipher();
Cipher segCipher = crypto.getSegmentCipher();
IncomingEncryptionLayer encryption =
- new IncomingSegmentedEncryptionLayer(in, tagCipher, segCipher,
+ new SegmentedIncomingEncryptionLayer(in, tagCipher, segCipher,
tagKey, segKey, false, bufferedSegment);
// No error correction
IncomingErrorCorrectionLayer correction =
@@ -92,7 +93,8 @@ class ConnectionReaderFactoryImpl implements ConnectionReaderFactory {
new IncomingAuthenticationLayerImpl(correction, mac, macKey);
// No reordering or retransmission
IncomingReliabilityLayer reliability =
- new NullIncomingReliabilityLayer(authentication);
+ new IncomingReliabilityLayerImpl(authentication,
+ new NullFrameWindow());
// Create the reader - don't tolerate errors
return new ConnectionReaderImpl(reliability, false);
}
diff --git a/components/net/sf/briar/transport/ConnectionWriterFactoryImpl.java b/components/net/sf/briar/transport/ConnectionWriterFactoryImpl.java
index 638295524..404a9bc23 100644
--- a/components/net/sf/briar/transport/ConnectionWriterFactoryImpl.java
+++ b/components/net/sf/briar/transport/ConnectionWriterFactoryImpl.java
@@ -60,7 +60,7 @@ class ConnectionWriterFactoryImpl implements ConnectionWriterFactory {
Cipher tagCipher = crypto.getTagCipher();
Cipher segCipher = crypto.getSegmentCipher();
OutgoingEncryptionLayer encryption =
- new OutgoingSegmentedEncryptionLayer(out, capacity, tagCipher,
+ new SegmentedOutgoingEncryptionLayer(out, capacity, tagCipher,
segCipher, tagKey, segKey, false);
// No error correction
OutgoingErrorCorrectionLayer correction =
diff --git a/components/net/sf/briar/transport/NullIncomingReliabilityLayer.java b/components/net/sf/briar/transport/IncomingReliabilityLayerImpl.java
similarity index 77%
rename from components/net/sf/briar/transport/NullIncomingReliabilityLayer.java
rename to components/net/sf/briar/transport/IncomingReliabilityLayerImpl.java
index ecd871d22..a5943a50a 100644
--- a/components/net/sf/briar/transport/NullIncomingReliabilityLayer.java
+++ b/components/net/sf/briar/transport/IncomingReliabilityLayerImpl.java
@@ -2,16 +2,17 @@ package net.sf.briar.transport;
import java.io.IOException;
-class NullIncomingReliabilityLayer implements IncomingReliabilityLayer {
+class IncomingReliabilityLayerImpl implements IncomingReliabilityLayer {
private final IncomingAuthenticationLayer in;
- private final int maxFrameLength;
private final FrameWindow window;
+ private final int maxFrameLength;
- NullIncomingReliabilityLayer(IncomingAuthenticationLayer in) {
+ IncomingReliabilityLayerImpl(IncomingAuthenticationLayer in,
+ FrameWindow window) {
this.in = in;
+ this.window = window;
maxFrameLength = in.getMaxFrameLength();
- window = new NullFrameWindow();
}
public boolean readFrame(Frame f) throws IOException, InvalidDataException {
diff --git a/components/net/sf/briar/transport/IncomingSegmentedEncryptionLayer.java b/components/net/sf/briar/transport/SegmentedIncomingEncryptionLayer.java
similarity index 96%
rename from components/net/sf/briar/transport/IncomingSegmentedEncryptionLayer.java
rename to components/net/sf/briar/transport/SegmentedIncomingEncryptionLayer.java
index 50dacb448..7f378c0eb 100644
--- a/components/net/sf/briar/transport/IncomingSegmentedEncryptionLayer.java
+++ b/components/net/sf/briar/transport/SegmentedIncomingEncryptionLayer.java
@@ -15,7 +15,7 @@ import net.sf.briar.api.crypto.ErasableKey;
import net.sf.briar.api.plugins.SegmentSource;
import net.sf.briar.api.transport.Segment;
-class IncomingSegmentedEncryptionLayer implements IncomingEncryptionLayer {
+class SegmentedIncomingEncryptionLayer implements IncomingEncryptionLayer {
private final SegmentSource in;
private final Cipher tagCipher, segCipher;
@@ -29,7 +29,7 @@ class IncomingSegmentedEncryptionLayer implements IncomingEncryptionLayer {
private boolean firstSegment = true;
private long segmentNumber = 0L;
- IncomingSegmentedEncryptionLayer(SegmentSource in, Cipher tagCipher,
+ SegmentedIncomingEncryptionLayer(SegmentSource in, Cipher tagCipher,
Cipher segCipher, ErasableKey tagKey, ErasableKey segKey,
boolean tagEverySegment, Segment bufferedSegment) {
this.in = in;
diff --git a/components/net/sf/briar/transport/OutgoingSegmentedEncryptionLayer.java b/components/net/sf/briar/transport/SegmentedOutgoingEncryptionLayer.java
similarity index 95%
rename from components/net/sf/briar/transport/OutgoingSegmentedEncryptionLayer.java
rename to components/net/sf/briar/transport/SegmentedOutgoingEncryptionLayer.java
index eb188ff60..4807e0d09 100644
--- a/components/net/sf/briar/transport/OutgoingSegmentedEncryptionLayer.java
+++ b/components/net/sf/briar/transport/SegmentedOutgoingEncryptionLayer.java
@@ -15,7 +15,7 @@ import net.sf.briar.api.crypto.ErasableKey;
import net.sf.briar.api.plugins.SegmentSink;
import net.sf.briar.api.transport.Segment;
-class OutgoingSegmentedEncryptionLayer implements OutgoingEncryptionLayer {
+class SegmentedOutgoingEncryptionLayer implements OutgoingEncryptionLayer {
private final SegmentSink out;
private final Cipher tagCipher, segCipher;
@@ -27,7 +27,7 @@ class OutgoingSegmentedEncryptionLayer implements OutgoingEncryptionLayer {
private long capacity;
- OutgoingSegmentedEncryptionLayer(SegmentSink out, long capacity,
+ SegmentedOutgoingEncryptionLayer(SegmentSink out, long capacity,
Cipher tagCipher, Cipher segCipher, ErasableKey tagKey,
ErasableKey segKey, boolean tagEverySegment) {
this.out = out;
diff --git a/test/build.xml b/test/build.xml
index a0c9523cc..8d73c651a 100644
--- a/test/build.xml
+++ b/test/build.xml
@@ -59,9 +59,9 @@
-
-
+
+
diff --git a/test/net/sf/briar/transport/ConnectionReaderImplTest.java b/test/net/sf/briar/transport/ConnectionReaderImplTest.java
index feaddea5c..3559501c4 100644
--- a/test/net/sf/briar/transport/ConnectionReaderImplTest.java
+++ b/test/net/sf/briar/transport/ConnectionReaderImplTest.java
@@ -224,7 +224,8 @@ public class ConnectionReaderImplTest extends TransportTest {
IncomingAuthenticationLayer authentication =
new IncomingAuthenticationLayerImpl(correction, mac, macKey);
IncomingReliabilityLayer reliability =
- new NullIncomingReliabilityLayer(authentication);
+ new IncomingReliabilityLayerImpl(authentication,
+ new NullFrameWindow());
return new ConnectionReaderImpl(reliability, false);
}
}
diff --git a/test/net/sf/briar/transport/FrameReadWriteTest.java b/test/net/sf/briar/transport/FrameReadWriteTest.java
index 5ca190878..98f50444d 100644
--- a/test/net/sf/briar/transport/FrameReadWriteTest.java
+++ b/test/net/sf/briar/transport/FrameReadWriteTest.java
@@ -103,7 +103,8 @@ public class FrameReadWriteTest extends BriarTestCase {
IncomingAuthenticationLayer authenticationIn =
new IncomingAuthenticationLayerImpl(correctionIn, mac, macKey);
IncomingReliabilityLayer reliabilityIn =
- new NullIncomingReliabilityLayer(authenticationIn);
+ new IncomingReliabilityLayerImpl(authenticationIn,
+ new NullFrameWindow());
ConnectionReader reader = new ConnectionReaderImpl(reliabilityIn,
false);
InputStream in1 = reader.getInputStream();
diff --git a/test/net/sf/briar/transport/IncomingSegmentedEncryptionLayerTest.java b/test/net/sf/briar/transport/SegmentedIncomingEncryptionLayerTest.java
similarity index 96%
rename from test/net/sf/briar/transport/IncomingSegmentedEncryptionLayerTest.java
rename to test/net/sf/briar/transport/SegmentedIncomingEncryptionLayerTest.java
index 13243605e..8f8f5bc31 100644
--- a/test/net/sf/briar/transport/IncomingSegmentedEncryptionLayerTest.java
+++ b/test/net/sf/briar/transport/SegmentedIncomingEncryptionLayerTest.java
@@ -22,12 +22,12 @@ import org.junit.Test;
import com.google.inject.Guice;
import com.google.inject.Injector;
-public class IncomingSegmentedEncryptionLayerTest extends BriarTestCase {
+public class SegmentedIncomingEncryptionLayerTest extends BriarTestCase {
private final Cipher tagCipher, segCipher;
private final ErasableKey tagKey, segKey;
- public IncomingSegmentedEncryptionLayerTest() {
+ public SegmentedIncomingEncryptionLayerTest() {
super();
Injector i = Guice.createInjector(new CryptoModule());
CryptoComponent crypto = i.getInstance(CryptoComponent.class);
@@ -65,7 +65,7 @@ public class IncomingSegmentedEncryptionLayerTest extends BriarTestCase {
SegmentSource in = new ByteArraySegmentSource(ciphertext1);
// Use the encryption layer to decrypt the ciphertext
IncomingEncryptionLayer decrypter =
- new IncomingSegmentedEncryptionLayer(in, tagCipher, segCipher,
+ new SegmentedIncomingEncryptionLayer(in, tagCipher, segCipher,
tagKey, segKey, false, buffered);
// First segment
Segment s = new SegmentImpl();
@@ -116,7 +116,7 @@ public class IncomingSegmentedEncryptionLayerTest extends BriarTestCase {
SegmentSource in = new ByteArraySegmentSource(ciphertext1);
// Use the encryption layer to decrypt the ciphertext
IncomingEncryptionLayer decrypter =
- new IncomingSegmentedEncryptionLayer(in, tagCipher, segCipher,
+ new SegmentedIncomingEncryptionLayer(in, tagCipher, segCipher,
tagKey, segKey, true, buffered);
// First segment
Segment s = new SegmentImpl();
diff --git a/test/net/sf/briar/transport/OutgoingSegmentedEncryptionLayerTest.java b/test/net/sf/briar/transport/SegmentedOutgoingEncryptionLayerTest.java
similarity index 95%
rename from test/net/sf/briar/transport/OutgoingSegmentedEncryptionLayerTest.java
rename to test/net/sf/briar/transport/SegmentedOutgoingEncryptionLayerTest.java
index 00d467e92..22bb21208 100644
--- a/test/net/sf/briar/transport/OutgoingSegmentedEncryptionLayerTest.java
+++ b/test/net/sf/briar/transport/SegmentedOutgoingEncryptionLayerTest.java
@@ -22,14 +22,14 @@ import org.junit.Test;
import com.google.inject.Guice;
import com.google.inject.Injector;
-public class OutgoingSegmentedEncryptionLayerTest extends BriarTestCase {
+public class SegmentedOutgoingEncryptionLayerTest extends BriarTestCase {
private static final int MAC_LENGTH = 32;
private final Cipher tagCipher, segCipher;
private final ErasableKey tagKey, segKey;
- public OutgoingSegmentedEncryptionLayerTest() {
+ public SegmentedOutgoingEncryptionLayerTest() {
super();
Injector i = Guice.createInjector(new CryptoModule());
CryptoComponent crypto = i.getInstance(CryptoComponent.class);
@@ -65,7 +65,7 @@ public class OutgoingSegmentedEncryptionLayerTest extends BriarTestCase {
// Use the encryption layer to encrypt the plaintext
ByteArraySegmentSink sink = new ByteArraySegmentSink();
OutgoingEncryptionLayer encrypter =
- new OutgoingSegmentedEncryptionLayer(sink, Long.MAX_VALUE,
+ new SegmentedOutgoingEncryptionLayer(sink, Long.MAX_VALUE,
tagCipher, segCipher, tagKey, segKey, false);
Segment s = new SegmentImpl();
System.arraycopy(plaintext, 0, s.getBuffer(), 0, plaintext.length);
@@ -113,7 +113,7 @@ public class OutgoingSegmentedEncryptionLayerTest extends BriarTestCase {
// Use the encryption layer to encrypt the plaintext
SegmentSink sink = new ByteArraySegmentSink();
OutgoingEncryptionLayer encrypter =
- new OutgoingSegmentedEncryptionLayer(sink, Long.MAX_VALUE,
+ new SegmentedOutgoingEncryptionLayer(sink, Long.MAX_VALUE,
tagCipher, segCipher, tagKey, segKey, true);
Segment s = new SegmentImpl();
System.arraycopy(plaintext, 0, s.getBuffer(), 0, plaintext.length);