40
40
import java .util .Collection ;
41
41
import java .util .List ;
42
42
import java .util .Random ;
43
- import java .util .concurrent .ExecutorService ;
44
- import java .util .concurrent .Executors ;
45
43
import java .util .concurrent .atomic .AtomicBoolean ;
46
44
import java .util .concurrent .atomic .AtomicReference ;
47
45
@@ -58,29 +56,21 @@ public class SocketSslEchoTest extends AbstractSocketTest {
58
56
random .nextBytes (data );
59
57
}
60
58
61
- @ Parameters (name = "{index}: " +
62
- "serverUsesDelegatedTaskExecutor = {0}, clientUsesDelegatedTaskExecutor = {1}, " +
63
- "useChunkedWriteHandler = {2}, useCompositeByteBuf = {3}" )
59
+ @ Parameters (name = "{index}: useChunkedWriteHandler = {0}, useCompositeByteBuf = {1}" )
64
60
public static Collection <Object []> data () {
65
61
List <Object []> params = new ArrayList <Object []>();
66
- for (int i = 0 ; i < 16 ; i ++) {
62
+ for (int i = 0 ; i < 4 ; i ++) {
67
63
params .add (new Object [] {
68
- (i & 8 ) != 0 , ( i & 4 ) != 0 , ( i & 2 ) != 0 , (i & 1 ) != 0
64
+ (i & 2 ) != 0 , (i & 1 ) != 0
69
65
});
70
66
}
71
67
return params ;
72
68
}
73
69
74
- private final boolean serverUsesDelegatedTaskExecutor ;
75
- private final boolean clientUsesDelegatedTaskExecutor ;
76
70
private final boolean useChunkedWriteHandler ;
77
71
private final boolean useCompositeByteBuf ;
78
72
79
- public SocketSslEchoTest (
80
- boolean serverUsesDelegatedTaskExecutor , boolean clientUsesDelegatedTaskExecutor ,
81
- boolean useChunkedWriteHandler , boolean useCompositeByteBuf ) {
82
- this .serverUsesDelegatedTaskExecutor = serverUsesDelegatedTaskExecutor ;
83
- this .clientUsesDelegatedTaskExecutor = clientUsesDelegatedTaskExecutor ;
73
+ public SocketSslEchoTest (boolean useChunkedWriteHandler , boolean useCompositeByteBuf ) {
84
74
this .useChunkedWriteHandler = useChunkedWriteHandler ;
85
75
this .useCompositeByteBuf = useCompositeByteBuf ;
86
76
}
@@ -91,7 +81,6 @@ public void testSslEcho() throws Throwable {
91
81
}
92
82
93
83
public void testSslEcho (ServerBootstrap sb , Bootstrap cb ) throws Throwable {
94
- final ExecutorService delegatedTaskExecutor = Executors .newCachedThreadPool ();
95
84
final EchoHandler sh = new EchoHandler (true , useCompositeByteBuf );
96
85
final EchoHandler ch = new EchoHandler (false , useCompositeByteBuf );
97
86
@@ -104,11 +93,7 @@ public void testSslEcho(ServerBootstrap sb, Bootstrap cb) throws Throwable {
104
93
@ Override
105
94
@ SuppressWarnings ("deprecation" )
106
95
public void initChannel (SocketChannel sch ) throws Exception {
107
- if (serverUsesDelegatedTaskExecutor ) {
108
- sch .pipeline ().addFirst ("ssl" , new SslHandler (sse , delegatedTaskExecutor ));
109
- } else {
110
- sch .pipeline ().addFirst ("ssl" , new SslHandler (sse ));
111
- }
96
+ sch .pipeline ().addFirst ("ssl" , new SslHandler (sse ));
112
97
if (useChunkedWriteHandler ) {
113
98
sch .pipeline ().addLast (new ChunkedWriteHandler ());
114
99
}
@@ -120,11 +105,7 @@ public void initChannel(SocketChannel sch) throws Exception {
120
105
@ Override
121
106
@ SuppressWarnings ("deprecation" )
122
107
public void initChannel (SocketChannel sch ) throws Exception {
123
- if (clientUsesDelegatedTaskExecutor ) {
124
- sch .pipeline ().addFirst ("ssl" , new SslHandler (cse , delegatedTaskExecutor ));
125
- } else {
126
- sch .pipeline ().addFirst ("ssl" , new SslHandler (cse ));
127
- }
108
+ sch .pipeline ().addFirst ("ssl" , new SslHandler (cse ));
128
109
if (useChunkedWriteHandler ) {
129
110
sch .pipeline ().addLast (new ChunkedWriteHandler ());
130
111
}
@@ -186,7 +167,6 @@ public void initChannel(SocketChannel sch) throws Exception {
186
167
sh .channel .close ().awaitUninterruptibly ();
187
168
ch .channel .close ().awaitUninterruptibly ();
188
169
sc .close ().awaitUninterruptibly ();
189
- delegatedTaskExecutor .shutdown ();
190
170
191
171
if (sh .exception .get () != null && !(sh .exception .get () instanceof IOException )) {
192
172
throw sh .exception .get ();
0 commit comments