summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorRobert Greig <rgreig@apache.org>2007-02-07 23:30:22 +0000
committerRobert Greig <rgreig@apache.org>2007-02-07 23:30:22 +0000
commitb4ec9cdf5a93e28b060cef4c1b4f4810111826ff (patch)
treeb25e55ed4b223076827254c3bf19872598a004d2 /java
parentb37d5db6ef5e5e9363a1e791dcf9a419bc348bb1 (diff)
downloadqpid-python-b4ec9cdf5a93e28b060cef4c1b4f4810111826ff.tar.gz
Added a system property qpid.accept.broker.version to allow the client to accept whatever version the broker offers on connection negotiation. Useful when testing different broker implementations that may not be in sync with Qpid versioning.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@504736 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java25
1 files changed, 17 insertions, 8 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
index 66fa9de92c..1dd9df0088 100644
--- a/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
+++ b/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
@@ -63,7 +63,7 @@ public class ConnectionStartMethodHandler implements StateAwareMethodListener
byte major = (byte) body.versionMajor;
byte minor = (byte) body.versionMinor;
- if(checkVersionOK(major, minor))
+ if (checkVersionOK(major, minor))
{
protocolSession.setProtocolVersion(major, minor);
@@ -169,16 +169,25 @@ public class ConnectionStartMethodHandler implements StateAwareMethodListener
private boolean checkVersionOK(byte versionMajor, byte versionMinor)
{
- byte[][] supportedVersions = ProtocolVersionList.pv;
- boolean supported = false;
- int i = supportedVersions.length;
- while(i-- != 0 && !supported)
+ // this system property allows the client to accept whatever version the broker
+ // offers. Useful only when doing testing.
+ if (Boolean.getBoolean("qpid.accept.broker.version"))
{
- supported = (supportedVersions[i][ProtocolVersionList.PROTOCOL_MAJOR] == versionMajor)
- && (supportedVersions[i][ProtocolVersionList.PROTOCOL_MINOR] == versionMinor);
+ return true;
}
+ else
+ {
+ byte[][] supportedVersions = ProtocolVersionList.pv;
+ boolean supported = false;
+ int i = supportedVersions.length;
+ while(i-- != 0 && !supported)
+ {
+ supported = (supportedVersions[i][ProtocolVersionList.PROTOCOL_MAJOR] == versionMajor)
+ && (supportedVersions[i][ProtocolVersionList.PROTOCOL_MINOR] == versionMinor);
+ }
- return supported;
+ return supported;
+ }
}
private String getFullSystemInfo()