File tree Expand file tree Collapse file tree 1 file changed +23
-11
lines changed
src/com/rabbitmq/client/impl Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -173,19 +173,31 @@ public static void protocolVersionMismatch(DataInputStream is) throws IOExceptio
173173 }
174174
175175 try {
176- int transportHigh = is .readUnsignedByte ();
177- int transportLow = is .readUnsignedByte ();
178- int serverMajor = is .readUnsignedByte ();
179- int serverMinor = is .readUnsignedByte ();
180-
181- // 0-8 gets these the wrong way round
182- if (serverMajor == 8 && serverMinor == 0 ) {
183- serverMajor = 0 ;
184- serverMinor = 8 ;
176+ int [] signature = new int [4 ];
177+
178+ for (int i = 0 ; i < 4 ; i ++) {
179+ signature [i ] = is .readUnsignedByte ();
180+ }
181+
182+ if (signature [0 ] == 1 &&
183+ signature [1 ] == 1 &&
184+ signature [2 ] == 8 &&
185+ signature [3 ] == 0 ) {
186+ x = new MalformedFrameException ("AMQP protocol version mismatch; we are version " +
187+ AMQP .PROTOCOL .MAJOR + "-" + AMQP .PROTOCOL .MINOR + "-" + AMQP .PROTOCOL .REVISION +
188+ ", server is 0-8" );
189+ }
190+ else {
191+ String sig = "" ;
192+ for (int i = 0 ; i < 4 ; i ++) {
193+ sig += signature [i ];
194+ }
195+
196+ x = new MalformedFrameException ("AMQP protocol version mismatch; we are version " +
197+ AMQP .PROTOCOL .MAJOR + "-" + AMQP .PROTOCOL .MINOR + "-" + AMQP .PROTOCOL .REVISION +
198+ ", server sent signature " + sig );
185199 }
186200
187- x = new MalformedFrameException ("AMQP protocol version mismatch; we are version " + AMQP .PROTOCOL .MAJOR + "-" + AMQP .PROTOCOL .MINOR
188- + ", server is " + serverMajor + "-" + serverMinor + " with transport " + transportHigh + "." + transportLow );
189201 } catch (IOException ex ) {
190202 x = new MalformedFrameException ("Invalid AMQP protocol header from server" );
191203 }
You can’t perform that action at this time.
0 commit comments