@@ -267,7 +267,8 @@ func TestConnectionHook(t *testing.T) {
267267 EndpointType : EndpointTypeAuto ,
268268 MaxWorkers : 2 ,
269269 HandoffQueueSize : 10 ,
270- MaxHandoffRetries : 3 , // Explicit queue size to avoid 0-size queue
270+ MaxHandoffRetries : 3 ,
271+ HandoffTimeout : 1 * time .Second , // Shorter timeout for faster test
271272 LogLevel : 2 ,
272273 }
273274 processor := NewPoolHook (failingDialer , "tcp" , config , nil )
@@ -293,7 +294,8 @@ func TestConnectionHook(t *testing.T) {
293294 }
294295
295296 // Wait for handoff to complete and fail with proper timeout and polling
296- timeout := time .After (2 * time .Second )
297+ // Use longer timeout to account for handoff timeout + processing time
298+ timeout := time .After (5 * time .Second )
297299 ticker := time .NewTicker (10 * time .Millisecond )
298300 defer ticker .Stop ()
299301
@@ -305,14 +307,14 @@ func TestConnectionHook(t *testing.T) {
305307 case <- timeout :
306308 t .Fatal ("Timeout waiting for failed handoff to complete" )
307309 case <- ticker .C :
308- if _ , pending := processor .pending .Load (conn ); ! pending {
310+ if _ , pending := processor .pending .Load (conn . GetID () ); ! pending {
309311 handoffCompleted = true
310312 }
311313 }
312314 }
313315
314316 // Connection should be removed from pending map after failed handoff
315- if _ , pending := processor .pending .Load (conn ); pending {
317+ if _ , pending := processor .pending .Load (conn . GetID () ); pending {
316318 t .Error ("Connection should be removed from pending map after failed handoff" )
317319 }
318320
0 commit comments