Skip to content

Commit 4534d20

Browse files
committed
Merge branch '4.x.x-stable' into 5.2.x-stable
2 parents 9a71310 + 7b35960 commit 4534d20

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/main/java/com/rabbitmq/client/ConnectionFactory.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ public class ConnectionFactory implements Cloneable {
6767
/** Default virtual host */
6868
public static final String DEFAULT_VHOST = "/";
6969
/** Default maximum channel number;
70-
* zero for unlimited */
71-
public static final int DEFAULT_CHANNEL_MAX = 0;
70+
* 2047 because it's 2048 on the server side minus channel 0,
71+
* which each connection uses for negotiation
72+
* and error communication */
73+
public static final int DEFAULT_CHANNEL_MAX = 2047;
7274
/** Default maximum frame size;
7375
* zero means no limit */
7476
public static final int DEFAULT_FRAME_MAX = 0;

src/test/java/com/rabbitmq/client/test/ChannelNumberAllocationTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,10 @@ public int compare(Channel x, Channel y){
119119
assertNotNull(connection.createChannel(5));
120120
assertNotNull(connection.createChannel(1));
121121
}
122+
123+
@Test public void channelMaxIs2047() {
124+
int channelMaxServerSide = 2048;
125+
int defaultChannelCount = 1;
126+
assertEquals(channelMaxServerSide - defaultChannelCount, connection.getChannelMax());
127+
}
122128
}

0 commit comments

Comments
 (0)