response_header_test.go 481 B

123456789101112131415161718192021
  1. package sarama
  2. import "testing"
  3. var (
  4. responseHeaderBytes = []byte{
  5. 0x00, 0x00, 0x0f, 0x00,
  6. 0x0a, 0xbb, 0xcc, 0xff}
  7. )
  8. func TestResponseHeader(t *testing.T) {
  9. header := responseHeader{}
  10. testDecodable(t, "response header", &header, responseHeaderBytes)
  11. if header.length != 0xf00 {
  12. t.Error("Decoding header length failed, got", header.length)
  13. }
  14. if header.correlationID != 0x0abbccff {
  15. t.Error("Decoding header correlation id failed, got", header.correlationID)
  16. }
  17. }