MCPcopy Create free account
hub / github.com/HyBuildNet/quic-relay / TestBufferPool

Function TestBufferPool

internal/proxy/proxy_test.go:157–180  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

155}
156
157func TestBufferPool(t *testing.T) {
158 // Get buffer
159 buf1 := handler.GetBuffer()
160 if buf1 == nil {
161 t.Fatal("GetBuffer returned nil")
162 }
163 if len(*buf1) != 65535 {
164 t.Errorf("expected buffer size 65535, got %d", len(*buf1))
165 }
166
167 // Return buffer
168 handler.PutBuffer(buf1)
169
170 // Get another buffer (might be the same one from pool)
171 buf2 := handler.GetBuffer()
172 if buf2 == nil {
173 t.Fatal("GetBuffer returned nil after PutBuffer")
174 }
175
176 handler.PutBuffer(buf2)
177
178 // PutBuffer with nil should not panic
179 handler.PutBuffer(nil)
180}

Callers

nothing calls this directly

Calls 2

GetBufferFunction · 0.92
PutBufferFunction · 0.92

Tested by

no test coverage detected