-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
14 changes: 13 additions & 1 deletion
14
lib/src/main/java/tech/relaycorp/awaladroid/messaging/Message.kt
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 |
---|---|---|
@@ -1,6 +1,18 @@ | ||
package tech.relaycorp.awaladroid.messaging | ||
|
||
import tech.relaycorp.relaynet.ramf.RAMFMessage | ||
|
||
/** | ||
* A service message. | ||
*/ | ||
public abstract class Message | ||
public abstract class Message { | ||
public companion object { | ||
private const val PESSIMISTIC_CMS_ENVELOPEDDATA_OVERHEAD_OCTETS = 1024 | ||
|
||
/** | ||
* The maximum size of the content of a message. | ||
*/ | ||
public const val MAX_CONTENT_SIZE: Int = | ||
RAMFMessage.MAX_PAYLOAD_LENGTH - PESSIMISTIC_CMS_ENVELOPEDDATA_OVERHEAD_OCTETS | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
lib/src/test/java/tech/relaycorp/awaladroid/messaging/MessageTest.kt
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,14 @@ | ||
package tech.relaycorp.awaladroid.messaging | ||
|
||
import org.junit.Assert | ||
import org.junit.Test | ||
import tech.relaycorp.relaynet.ramf.RAMFMessage | ||
|
||
public class MessageTest { | ||
@Test | ||
public fun maxContentSize() { | ||
val expectedMax = RAMFMessage.MAX_PAYLOAD_LENGTH - 1024 | ||
|
||
Assert.assertEquals(Message.MAX_CONTENT_SIZE, expectedMax) | ||
} | ||
} |
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