add failing test
diff --git a/include/picotls.h b/include/picotls.h
index 135f44d..e4c4499 100644
--- a/include/picotls.h
+++ b/include/picotls.h
@@ -512,6 +512,10 @@
      * if ESNI was used
      */
     unsigned esni : 1;
+    /**
+     * set to 1 if ClientHello is too old (or too new) to be handled by picotls
+     */
+    unsigned incompatible_version : 1;
 } ptls_on_client_hello_parameters_t;
 
 /**
diff --git a/t/picotls.c b/t/picotls.c
index eece965..b85109c 100644
--- a/t/picotls.c
+++ b/t/picotls.c
@@ -1544,6 +1544,50 @@
     subtest("block", test_quicblock);
 }
 
+static const uint8_t tls12_client_hello[] = {
+    0x16, 0x03, 0x01, 0x00, 0xd2, 0x01, 0x00, 0x00, 0xce, 0x03, 0x03, 0xd1, 0x01, 0x0e, 0x39, 0xea, 0x22, 0x28, 0x89, 0x99,
+    0x42, 0xec, 0x70, 0xfa, 0xb3, 0x47, 0x01, 0xce, 0x61, 0x8d, 0xee, 0x0e, 0x3e, 0xf7, 0xe9, 0x4f, 0x0a, 0x8e, 0x94, 0x28,
+    0xe5, 0xe3, 0xd3, 0x00, 0x00, 0x5c, 0xc0, 0x30, 0xc0, 0x2c, 0xc0, 0x28, 0xc0, 0x24, 0xc0, 0x14, 0xc0, 0x0a, 0x00, 0x9f,
+    0x00, 0x6b, 0x00, 0x39, 0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0xaa, 0xff, 0x85, 0x00, 0xc4, 0x00, 0x88, 0x00, 0x81, 0x00, 0x9d,
+    0x00, 0x3d, 0x00, 0x35, 0x00, 0xc0, 0x00, 0x84, 0xc0, 0x2f, 0xc0, 0x2b, 0xc0, 0x27, 0xc0, 0x23, 0xc0, 0x13, 0xc0, 0x09,
+    0x00, 0x9e, 0x00, 0x67, 0x00, 0x33, 0x00, 0xbe, 0x00, 0x45, 0x00, 0x9c, 0x00, 0x3c, 0x00, 0x2f, 0x00, 0xba, 0x00, 0x41,
+    0xc0, 0x11, 0xc0, 0x07, 0x00, 0x05, 0x00, 0x04, 0xc0, 0x12, 0xc0, 0x08, 0x00, 0x16, 0x00, 0x0a, 0x00, 0xff, 0x01, 0x00,
+    0x00, 0x49, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0d, 0x00, 0x00, 0x0a, 0x69, 0x5f, 0x6e, 0x65, 0x65, 0x64, 0x5f, 0x73, 0x6e,
+    0x69, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x06, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00,
+    0x23, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x1c, 0x00, 0x1a, 0x06, 0x01, 0x06, 0x03, 0xef, 0xef, 0x05, 0x01, 0x05, 0x03, 0x04,
+    0x01, 0x04, 0x03, 0xee, 0xee, 0xed, 0xed, 0x03, 0x01, 0x03, 0x03, 0x02, 0x01, 0x02, 0x03};
+static int test_tls12_on_client_hello_called = 0;
+
+static int test_tls12_on_client_hello(ptls_on_client_hello_t *self, ptls_t *tls, ptls_on_client_hello_parameters_t *params)
+{
+    test_tls12_on_client_hello_called = 1;
+    ok(params->incompatible_version);
+    ok(sizeof(tls12_client_hello) - 5 == params->raw_message.len);
+    ok(memcmp(tls12_client_hello + 5, params->raw_message.base, params->raw_message.len) == 0);
+    ok(params->server_name.len == sizeof("i-need_sni") - 1);
+    ok(memcmp(params->server_name.base, "i_need_sni", sizeof("i-need_sni") - 1) == 0);
+    return 0;
+}
+
+static void test_tls12_hello(void)
+{
+    ptls_on_client_hello_t on_client_hello = {test_tls12_on_client_hello}, *orig = ctx->on_client_hello;
+    ctx->on_client_hello = &on_client_hello;
+
+    test_tls12_on_client_hello_called = 0;
+
+    ptls_t *tls = ptls_new(ctx, 1);
+    ptls_buffer_t sendbuf;
+    ptls_buffer_init(&sendbuf, "", 0);
+    size_t len = sizeof(tls12_client_hello);
+    int ret = ptls_handshake(tls, &sendbuf, tls12_client_hello, &len, NULL);
+    ok(ret == PTLS_ALERT_PROTOCOL_VERSION);
+
+    ok(test_tls12_on_client_hello_called);
+
+    ctx->on_client_hello = orig;
+}
+
 void test_picotls(void)
 {
     subtest("is_ipaddr", test_is_ipaddr);
@@ -1563,6 +1607,7 @@
     subtest("fragmented-message", test_fragmented_message);
     subtest("handshake", test_all_handshakes);
     subtest("quic", test_quic);
+    subtest("tls12-hello", test_tls12_hello);
 }
 
 void test_picotls_esni(ptls_key_exchange_context_t **keys)