diff options
| author | Robert Gemmell <robbie@apache.org> | 2012-11-04 02:06:45 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2012-11-04 02:06:45 +0000 |
| commit | 21c46c90f7b2e7ea4f491524c6a0f619da196900 (patch) | |
| tree | 123f8ab4d5ce3f57c54e347a980e4389cb81d843 /java | |
| parent | 75069345199f32452f918a11df9b28b35525450b (diff) | |
| download | qpid-python-21c46c90f7b2e7ea4f491524c6a0f619da196900.tar.gz | |
QPID-4419: ensure the broker kills the 0-10 connection immediately for explicit reason that no sasl mech was chosen, instead of sending an incorrect ConnectionTune and then killing the connection as side effect of a subsequent NPE.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1405489 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
| -rw-r--r-- | java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java | 5 | ||||
| -rw-r--r-- | java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java b/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java index e9a7d51456..1e0d5b9698 100644 --- a/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java +++ b/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java @@ -71,7 +71,8 @@ public class ServerDelegate extends ConnectionDelegate if (mechanism == null || mechanism.length() == 0) { - tuneAuthorizedConnection(conn); + conn.connectionClose(ConnectionCloseCode.CONNECTION_FORCED, + "No Sasl mechanism was specified"); return; } @@ -82,7 +83,7 @@ public class ServerDelegate extends ConnectionDelegate if (ss == null) { conn.connectionClose(ConnectionCloseCode.CONNECTION_FORCED, - "null SASL mechanism: " + mechanism); + "No SaslServer could be created for mechanism: " + mechanism); return; } conn.setSaslServer(ss); diff --git a/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java b/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java index f3715f351e..12bbd20228 100644 --- a/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java +++ b/java/common/src/test/java/org/apache/qpid/transport/ConnectionTest.java @@ -155,6 +155,7 @@ public class ConnectionTest extends QpidTestCase implements SessionListener { final Connection conn = new Connection(); conn.setConnectionDelegate(new ClientDelegate(new ConnectionSettings())); + conn.addConnectionListener(new ConnectionListener() { public void opened(Connection conn) {} @@ -225,6 +226,12 @@ public class ConnectionTest extends QpidTestCase implements SessionListener ssn.setSessionListener(ConnectionTest.this); return ssn; } + + @Override + public void connectionStartOk(Connection conn, ConnectionStartOk ok) + { + tuneAuthorizedConnection(conn); + } }; try |
