File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
src/test/java/com/rabbitmq/client/test Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 24
24
import org .junit .jupiter .api .Test ;
25
25
import org .mockito .Mockito ;
26
26
27
- import java .io . IOException ;
28
- import java .util .concurrent .* ;
27
+ import java .util . concurrent . ExecutorService ;
28
+ import java .util .concurrent .Executors ;
29
29
import java .util .stream .Stream ;
30
30
import static org .assertj .core .api .Assertions .assertThatThrownBy ;
31
31
import static org .junit .jupiter .api .Assertions .assertNotNull ;
@@ -93,17 +93,16 @@ public void confirmSelectOnlySendsRPCCallOnce() throws Exception {
93
93
94
94
ChannelN channel = new ChannelN (connection , 1 , consumerWorkService );
95
95
96
- Future < AMQImpl . Confirm . SelectOk > future = executorService . submit (() -> {
96
+ new Thread (() -> {
97
97
try {
98
- return channel .confirmSelect ();
99
- } catch (IOException e ) {
98
+ Thread .sleep (15 );
99
+ channel .handleCompleteInboundCommand (new AMQCommand (new AMQImpl .Confirm .SelectOk ()));
100
+ } catch (Exception e ) {
100
101
throw new RuntimeException (e );
101
102
}
102
- });
103
+ }). start () ;
103
104
104
- channel .handleCompleteInboundCommand (new AMQCommand (new AMQImpl .Confirm .SelectOk ()));
105
-
106
- assertNotNull (future .get (1 , TimeUnit .SECONDS ));
105
+ assertNotNull (channel .confirmSelect ());
107
106
assertNotNull (channel .confirmSelect ());
108
107
Mockito .verify (trafficListener , Mockito .times (1 )).write (Mockito .any (Command .class ));
109
108
}
You can’t perform that action at this time.
0 commit comments