mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Application layer keepalives to detect dead TCP connections.
DuplexOutgoingSession flushes its output stream if it's idle for a transport-defined interval, causing an empty frame to be sent. The TCP and Tor plugins use a socket timeout equal to twice the idle interval to detect dead connections. See bugs #27, #46 and #60.
This commit is contained in:
@@ -31,11 +31,15 @@ public class StreamWriterImplTest extends BriarTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFlushWithoutBufferedDataOnlyFlushes() throws Exception {
|
||||
public void testFlushWithoutBufferedDataWritesFrameAndFlushes()
|
||||
throws Exception {
|
||||
Mockery context = new Mockery();
|
||||
final FrameWriter writer = context.mock(FrameWriter.class);
|
||||
StreamWriterImpl w = new StreamWriterImpl(writer, FRAME_LENGTH);
|
||||
context.checking(new Expectations() {{
|
||||
// Write a non-final frame with an empty payload
|
||||
oneOf(writer).writeFrame(with(any(byte[].class)), with(0),
|
||||
with(false));
|
||||
// Flush the stream
|
||||
oneOf(writer).flush();
|
||||
}});
|
||||
|
||||
Reference in New Issue
Block a user