-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix the disconnect on oversized message fix #499
- actually disconnect - handle case where at most 2 bytes overflow - handle back-pressure when saving invalid message
- Loading branch information
1 parent
076a5b4
commit d370dac
Showing
7 changed files
with
171 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
artio-core/src/test/java/uk/co/real_logic/artio/TestFixturesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package uk.co.real_logic.artio; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import uk.co.real_logic.artio.decoder.HeartbeatDecoder; | ||
import uk.co.real_logic.artio.util.MutableAsciiBuffer; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class TestFixturesTest | ||
{ | ||
@Test | ||
void shouldGenerateMessageOfGivenLength() | ||
{ | ||
final int messageLength = 256; | ||
final byte[] bytes = TestFixtures.largeMessage(messageLength); | ||
assertEquals(messageLength, bytes.length); | ||
|
||
final HeartbeatDecoder decoder = new HeartbeatDecoder(); | ||
final MutableAsciiBuffer buffer = new MutableAsciiBuffer(bytes); | ||
decoder.decode(buffer, 0, bytes.length); | ||
assertTrue(decoder.validate()); | ||
assertEquals(buffer.computeChecksum(0, messageLength - 7), | ||
Integer.parseInt(decoder.trailer().checkSumAsString(), 10)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters