File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
main/java/com/rabbitmq/client/impl/recovery
test/java/com/rabbitmq/client/test/functional Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,13 @@ public Channel createChannel() throws IOException {
176
176
*/
177
177
@ Override
178
178
public Channel createChannel (int channelNumber ) throws IOException {
179
- return delegate .createChannel (channelNumber );
179
+ RecoveryAwareChannelN ch = (RecoveryAwareChannelN ) delegate .createChannel (channelNumber );
180
+ // No Sonar: the channel could be null
181
+ if (ch == null ) { //NOSONAR
182
+ return null ;
183
+ } else {
184
+ return this .wrapChannel (ch );
185
+ }
180
186
}
181
187
182
188
/**
Original file line number Diff line number Diff line change @@ -281,6 +281,22 @@ public void handleUnblocked() throws IOException {
281
281
expectChannelRecovery (ch2 );
282
282
}
283
283
284
+ @ Test public void channelRecoveryWithUserProvidedChannelIDs () throws IOException , InterruptedException {
285
+ int n1 = 11 ;
286
+ Channel ch1 = connection .createChannel (n1 );
287
+ int n2 = 22 ;
288
+ Channel ch2 = connection .createChannel (n2 );
289
+
290
+ assertThat (ch1 .isOpen ()).isTrue ();
291
+ assertThat (ch2 .isOpen ()).isTrue ();
292
+ closeAndWaitForRecovery ();
293
+ expectChannelRecovery (ch1 );
294
+ expectChannelRecovery (ch2 );
295
+
296
+ assertThat (ch1 .getChannelNumber ()).isEqualTo (n1 );
297
+ assertThat (ch2 .getChannelNumber ()).isEqualTo (n2 );
298
+ }
299
+
284
300
@ Test public void returnListenerRecovery () throws IOException , InterruptedException {
285
301
final CountDownLatch latch = new CountDownLatch (1 );
286
302
channel .addReturnListener (new ReturnListener () {
You can’t perform that action at this time.
0 commit comments