use of software.amazon.awssdk.crt.eventstream.Header in project aws-crt-java by awslabs.
the class EventStreamHeaderTest method testIntHeaderSerialization.
@Test
public void testIntHeaderSerialization() {
Header header = Header.createHeader("testHeader", 123456789);
ByteBuffer serializedBuffer = ByteBuffer.allocate(1024);
header.writeToByteBuffer(serializedBuffer);
serializedBuffer.position(0);
Header deserializedHeader = Header.fromByteBuffer(serializedBuffer);
assertEquals(header, deserializedHeader);
}
use of software.amazon.awssdk.crt.eventstream.Header in project aws-crt-java by awslabs.
the class EventStreamHeaderTest method testDateHeaderSerialization.
@Test
public void testDateHeaderSerialization() {
Date headerValue = new Date();
Header header = Header.createHeader("testHeader", headerValue);
ByteBuffer serializedBuffer = ByteBuffer.allocate(1024);
header.writeToByteBuffer(serializedBuffer);
serializedBuffer.position(0);
Header deserializedHeader = Header.fromByteBuffer(serializedBuffer);
assertEquals(header, deserializedHeader);
}
use of software.amazon.awssdk.crt.eventstream.Header in project aws-crt-java by awslabs.
the class EventStreamHeaderTest method testByteHeader.
@Test
public void testByteHeader() {
Header byteHeader = Header.createHeader("testHeader", (byte) 127);
assertEquals(127, byteHeader.getValueAsByte());
assertEquals("testHeader", byteHeader.getName());
assertEquals(HeaderType.Byte, byteHeader.getHeaderType());
}
use of software.amazon.awssdk.crt.eventstream.Header in project aws-crt-java by awslabs.
the class EventStreamHeaderTest method testShortHeader.
@Test
public void testShortHeader() {
Header shortHeader = Header.createHeader("testHeader", (short) 8001);
assertEquals(8001, shortHeader.getValueAsShort());
assertEquals("testHeader", shortHeader.getName());
assertEquals(HeaderType.Int16, shortHeader.getHeaderType());
}
use of software.amazon.awssdk.crt.eventstream.Header in project aws-crt-java by awslabs.
the class EventStreamHeaderTest method testLongHeaderSerialization.
@Test
public void testLongHeaderSerialization() {
Header header = Header.createHeader("testHeader", (long) Integer.MAX_VALUE + 1);
ByteBuffer serializedBuffer = ByteBuffer.allocate(1024);
header.writeToByteBuffer(serializedBuffer);
serializedBuffer.position(0);
Header deserializedHeader = Header.fromByteBuffer(serializedBuffer);
assertEquals(header, deserializedHeader);
}
Aggregations