| 14 | ) |
| 15 | |
| 16 | func TestIssue477(t *testing.T) { |
| 17 | // This test verifies that a connection attempt with a minimal TLS |
| 18 | // configuration does not panic. |
| 19 | l, err := net.Listen("tcp", "127.0.0.1:0") |
| 20 | if err != nil { |
| 21 | t.Fatal(err) |
| 22 | } |
| 23 | defer l.Close() |
| 24 | |
| 25 | cg := connGroup{ |
| 26 | addr: l.Addr(), |
| 27 | pool: &connPool{ |
| 28 | dial: defaultDialer.DialContext, |
| 29 | tls: &tls.Config{}, |
| 30 | }, |
| 31 | } |
| 32 | |
| 33 | if _, err := cg.connect(context.Background(), cg.addr); err != nil { |
| 34 | // An error is expected here because we are not actually establishing |
| 35 | // a TLS connection to a kafka broker. |
| 36 | t.Log(err) |
| 37 | } else { |
| 38 | t.Error("no error was reported when attempting to establish a TLS connection to a non-TLS endpoint") |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func TestIssue672(t *testing.T) { |
| 43 | // ensure the test times out if the bug is re-introduced |