(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestReadResponseUnexpectedTLSDetection(t *testing.T) { |
| 12 | var buf bytes.Buffer |
| 13 | |
| 14 | buf.Write([]byte{tlsAlertByte, 0x03, 0x03, 10, 0, 0, 0}) |
| 15 | |
| 16 | correlationID, _, err := ReadResponse(&buf, ApiVersions, 0) |
| 17 | if !errors.Is(err, io.ErrUnexpectedEOF) { |
| 18 | t.Fatalf("expected an io.ErrUnexpectedEOF from ReadResponse got %v", err) |
| 19 | } |
| 20 | |
| 21 | if !strings.Contains(err.Error(), "broker appears to be expecting TLS") { |
| 22 | t.Fatalf("expected error messae to contain %s got %s", "broker appears to be expecting TLS", err.Error()) |
| 23 | } |
| 24 | |
| 25 | if correlationID != 0 { |
| 26 | t.Fatalf("expected correlationID of 0 got %d", correlationID) |
| 27 | } |
| 28 | } |
nothing calls this directly
no test coverage detected