| TestNew | Basic middleware creation | Middleware initializes with default options and processes HTTP/1.1 requests |
| TestDetectHTTP1 | HTTP/1.1 detection | Correctly identifies HTTP/1.x requests, sets IsHTTP2 to false |
| TestIsH2CUpgrade | Upgrade request validation | Validates h2c upgrade headers (Connection, Upgrade, HTTP2-Settings) |
| TestContainsToken | Header token parsing | Correctly parses comma-separated header values |
| TestGetInfo | Context info retrieval | Retrieves h2c info from request context |
| TestIsHTTP2 | HTTP/2 detection helper | Returns correct boolean for HTTP/2 detection |
| TestParseSettings | HTTP2-Settings parsing | Decodes base64-encoded settings header |
| TestParseSettingsEmpty | Empty settings handling | Returns nil for missing HTTP2-Settings header |
| TestParseSettingsInvalid | Invalid settings handling | Returns error for malformed base64 |
| TestOnUpgrade | Upgrade callback | Executes OnUpgrade callback when upgrade occurs |
| TestServerHandler | ServerHandler creation | Creates handler with h2c support |
| TestWrap | Handler wrapping | Wraps standard http.Handler with h2c support |
| TestIsHTTP2Preface | Preface detection | Validates HTTP/2 connection preface bytes |
| TestDetect | Detection-only mode | Detects h2c without handling upgrade |
| TestWithOptionsDisabled | Disabled options | Respects AllowUpgrade and AllowDirect settings |
| TestBufferedConn | Buffered connection | Handles buffered reading with Peek and Read |
| TestGetInfo_NoContext | Missing context info | Returns empty Info when middleware not used |
| TestDetect_WithH2CUpgrade | Upgrade detection | Correctly detects and marks upgrade requests |
| TestServerHandler_WithH2CUpgrade | Handler upgrade flow | Processes h2c upgrade in ServerHandler |
| TestServerHandler_UpgradeDisabled | Disabled upgrade handling | Falls back to handler when upgrade disabled |
| TestInfo_Fields | Info struct fields | Validates Info struct field values |
| TestConnectionPreface | Preface constant | Verifies correct HTTP/2 preface constant |
| TestWithOptions_HTTP2PriorKnowledge | Prior knowledge handling | Detects direct HTTP/2 connections |
| TestWithOptions_H2CUpgradeWithCallback | Upgrade with callback | Executes callback during upgrade |
| TestHandleUpgrade_NonHijackable | Non-hijackable fallback | Falls back to HTTP/1.1 when hijack unsupported |
| TestServerHandler_HTTP2PriorKnowledge | Prior knowledge in handler | Handles HTTP/2 prior knowledge in ServerHandler |
| TestServerHandler_H2CUpgrade_WithHijack | Successful hijack | Successfully hijacks connection for upgrade |
| TestServerHandler_H2CUpgrade_HijackError | Hijack error handling | Falls back to handler on hijack error |
| TestServerHandler_NonHijackable | Handler fallback | Falls back when ResponseWriter not hijackable |
| TestDetect_HTTP2PriorKnowledge | Prior knowledge detection | Detects HTTP/2 prior knowledge in Detect mode |
| TestBufferedConn_Underlying | Underlying connection ops | Validates Write, Close operations on BufferedConn |
| TestWithOptions_H2CUpgrade_HijackError | Middleware hijack error | Handles hijack errors in middleware |
| TestBufferedConn_NetConnInterface | net.Conn interface | Validates complete net.Conn interface implementation |