mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
PacketWriters aren't responsible for flushing their output streams.
This commit is contained in:
@@ -125,8 +125,8 @@ public class ProtocolIntegrationTest extends BriarTestCase {
|
||||
StreamWriter streamWriter = streamWriterFactory.createStreamWriter(out,
|
||||
MAX_FRAME_LENGTH, ctx);
|
||||
OutputStream out1 = streamWriter.getOutputStream();
|
||||
PacketWriter packetWriter = packetWriterFactory.createPacketWriter(out1,
|
||||
false);
|
||||
PacketWriter packetWriter =
|
||||
packetWriterFactory.createPacketWriter(out1);
|
||||
|
||||
packetWriter.writeAck(new Ack(messageIds));
|
||||
|
||||
@@ -144,7 +144,7 @@ public class ProtocolIntegrationTest extends BriarTestCase {
|
||||
transportProperties, 1);
|
||||
packetWriter.writeTransportUpdate(tu);
|
||||
|
||||
packetWriter.flush();
|
||||
out1.flush();
|
||||
return out.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ public class ConstantsTest extends BriarTestCase {
|
||||
TransportUpdate u = new TransportUpdate(id, p, Long.MAX_VALUE);
|
||||
// Serialise the update
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
PacketWriter writer = packetWriterFactory.createPacketWriter(out, true);
|
||||
PacketWriter writer = packetWriterFactory.createPacketWriter(out);
|
||||
writer.writeTransportUpdate(u);
|
||||
// Check the size of the serialised transport update
|
||||
assertTrue(out.size() <= MAX_PACKET_LENGTH);
|
||||
@@ -197,7 +197,7 @@ public class ConstantsTest extends BriarTestCase {
|
||||
SubscriptionUpdate u = new SubscriptionUpdate(groups, Long.MAX_VALUE);
|
||||
// Serialise the update
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
PacketWriter writer = packetWriterFactory.createPacketWriter(out, true);
|
||||
PacketWriter writer = packetWriterFactory.createPacketWriter(out);
|
||||
writer.writeSubscriptionUpdate(u);
|
||||
// Check the size of the serialised subscription update
|
||||
assertTrue(out.size() <= MAX_PACKET_LENGTH);
|
||||
@@ -206,7 +206,7 @@ public class ConstantsTest extends BriarTestCase {
|
||||
private void testMessageIdsFitIntoAck(int length) throws Exception {
|
||||
// Create an ack with as many message IDs as possible
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream(length);
|
||||
PacketWriter writer = packetWriterFactory.createPacketWriter(out, true);
|
||||
PacketWriter writer = packetWriterFactory.createPacketWriter(out);
|
||||
int maxMessages = writer.getMaxMessagesForAck(length);
|
||||
Collection<MessageId> ids = new ArrayList<MessageId>();
|
||||
for(int i = 0; i < maxMessages; i++)
|
||||
@@ -219,7 +219,7 @@ public class ConstantsTest extends BriarTestCase {
|
||||
private void testMessageIdsFitIntoRequest(int length) throws Exception {
|
||||
// Create a request with as many message IDs as possible
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream(length);
|
||||
PacketWriter writer = packetWriterFactory.createPacketWriter(out, true);
|
||||
PacketWriter writer = packetWriterFactory.createPacketWriter(out);
|
||||
int maxMessages = writer.getMaxMessagesForRequest(length);
|
||||
Collection<MessageId> ids = new ArrayList<MessageId>();
|
||||
for(int i = 0; i < maxMessages; i++)
|
||||
@@ -232,7 +232,7 @@ public class ConstantsTest extends BriarTestCase {
|
||||
private void testMessageIdsFitIntoOffer(int length) throws Exception {
|
||||
// Create an offer with as many message IDs as possible
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream(length);
|
||||
PacketWriter writer = packetWriterFactory.createPacketWriter(out, true);
|
||||
PacketWriter writer = packetWriterFactory.createPacketWriter(out);
|
||||
int maxMessages = writer.getMaxMessagesForOffer(length);
|
||||
Collection<MessageId> ids = new ArrayList<MessageId>();
|
||||
for(int i = 0; i < maxMessages; i++)
|
||||
|
||||
Reference in New Issue
Block a user