@@ -11,6 +11,8 @@ import (
1111 "sync"
1212 "testing"
1313 "time"
14+
15+ "github.com/oxtoacart/bpool"
1416)
1517
1618func TestServerListenAndServe (t * testing.T ) {
@@ -55,9 +57,7 @@ func TestServerServe(t *testing.T) {
5557
5658func TestServerPoll (t * testing.T ) {
5759 var handler = & DataHandler {
58- NoShared : false ,
59- NoCopy : false ,
60- BufferSize : 1024 ,
60+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
6161 HandlerFunc : func (req []byte ) (res []byte ) {
6262 res = req
6363 return
@@ -88,9 +88,7 @@ func TestServerPoll(t *testing.T) {
8888
8989func TestServerClose (t * testing.T ) {
9090 var handler = & DataHandler {
91- NoShared : false ,
92- NoCopy : false ,
93- BufferSize : 1024 ,
91+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
9492 HandlerFunc : func (req []byte ) (res []byte ) {
9593 res = req
9694 return
@@ -117,9 +115,7 @@ func TestServerClose(t *testing.T) {
117115
118116func TestServerNumCPU (t * testing.T ) {
119117 var handler = & DataHandler {
120- NoShared : false ,
121- NoCopy : false ,
122- BufferSize : 1024 ,
118+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
123119 HandlerFunc : func (req []byte ) (res []byte ) {
124120 res = req
125121 return
@@ -148,9 +144,7 @@ func TestServerNumCPU(t *testing.T) {
148144
149145func TestServerTCPListener (t * testing.T ) {
150146 var handler = & DataHandler {
151- NoShared : false ,
152- NoCopy : false ,
153- BufferSize : 1024 ,
147+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
154148 HandlerFunc : func (req []byte ) (res []byte ) {
155149 res = req
156150 return
@@ -171,9 +165,7 @@ func TestServerTCPListener(t *testing.T) {
171165
172166func TestServerUNIXListener (t * testing.T ) {
173167 var handler = & DataHandler {
174- NoShared : false ,
175- NoCopy : false ,
176- BufferSize : 1024 ,
168+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
177169 HandlerFunc : func (req []byte ) (res []byte ) {
178170 res = req
179171 return
@@ -194,9 +186,7 @@ func TestServerUNIXListener(t *testing.T) {
194186
195187func TestTCPServer (t * testing.T ) {
196188 var handler = & DataHandler {
197- NoShared : false ,
198- NoCopy : false ,
199- BufferSize : 1024 ,
189+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
200190 HandlerFunc : func (req []byte ) (res []byte ) {
201191 res = req
202192 return
@@ -245,9 +235,7 @@ func TestTCPServer(t *testing.T) {
245235
246236func TestUNIXServer (t * testing.T ) {
247237 var handler = & DataHandler {
248- NoShared : false ,
249- NoCopy : false ,
250- BufferSize : 1024 ,
238+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
251239 HandlerFunc : func (req []byte ) (res []byte ) {
252240 res = req
253241 return
@@ -296,9 +284,7 @@ func TestOtherServer(t *testing.T) {
296284 net.Listener
297285 }
298286 var handler = & DataHandler {
299- NoShared : false ,
300- NoCopy : false ,
301- BufferSize : 1024 ,
287+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
302288 HandlerFunc : func (req []byte ) (res []byte ) {
303289 res = req
304290 return
@@ -342,9 +328,7 @@ func TestOtherServer(t *testing.T) {
342328
343329func TestShared (t * testing.T ) {
344330 var handler = & DataHandler {
345- NoShared : false ,
346- NoCopy : false ,
347- BufferSize : 1024 ,
331+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
348332 HandlerFunc : func (req []byte ) (res []byte ) {
349333 res = req
350334 return
@@ -388,9 +372,7 @@ func TestShared(t *testing.T) {
388372
389373func TestNoCopy (t * testing.T ) {
390374 var handler = & DataHandler {
391- NoShared : true ,
392- NoCopy : true ,
393- BufferSize : 1024 ,
375+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
394376 HandlerFunc : func (req []byte ) (res []byte ) {
395377 res = req
396378 return
@@ -483,9 +465,7 @@ func TestWorker(t *testing.T) {
483465
484466func TestNoAsync (t * testing.T ) {
485467 var handler = & DataHandler {
486- NoShared : true ,
487- NoCopy : true ,
488- BufferSize : 1024 ,
468+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
489469 HandlerFunc : func (req []byte ) (res []byte ) {
490470 res = req
491471 return
@@ -530,9 +510,7 @@ func TestNoAsync(t *testing.T) {
530510
531511func TestSharedWorkers (t * testing.T ) {
532512 var handler = & DataHandler {
533- NoShared : true ,
534- NoCopy : true ,
535- BufferSize : 1024 ,
513+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
536514 HandlerFunc : func (req []byte ) (res []byte ) {
537515 res = req
538516 return
@@ -579,9 +557,7 @@ func TestSharedWorkers(t *testing.T) {
579557
580558func TestSharedWorkersPanic (t * testing.T ) {
581559 var handler = & DataHandler {
582- NoShared : true ,
583- NoCopy : true ,
584- BufferSize : 1024 ,
560+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
585561 HandlerFunc : func (req []byte ) (res []byte ) {
586562 res = req
587563 return
@@ -606,9 +582,7 @@ func TestSharedWorkersPanic(t *testing.T) {
606582
607583func TestReschedule (t * testing.T ) {
608584 var handler = & DataHandler {
609- NoShared : false ,
610- NoCopy : false ,
611- BufferSize : 1024 ,
585+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
612586 HandlerFunc : func (req []byte ) (res []byte ) {
613587 res = req
614588 return
@@ -669,9 +643,7 @@ func TestReschedule(t *testing.T) {
669643
670644func TestRescheduleDone (t * testing.T ) {
671645 var handler = & DataHandler {
672- NoShared : false ,
673- NoCopy : false ,
674- BufferSize : 1024 ,
646+ Pool : bpool .NewBytePool (1024 , 12 * 1024 ),
675647 HandlerFunc : func (req []byte ) (res []byte ) {
676648 res = req
677649 return
0 commit comments