Skip to content

Commit 60f038f

Browse files
author
Simon MacMullen
committed
Merge default into amqp_0_9_1
2 parents 81dc6e2 + bfb7ad6 commit 60f038f

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

src/com/rabbitmq/client/impl/AMQChannel.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ public static IOException wrap(ShutdownSignalException ex) {
123123
return ioe;
124124
}
125125

126+
public static IOException wrap(ShutdownSignalException ex, String message) {
127+
IOException ioe = new IOException(message);
128+
ioe.initCause(ex);
129+
return ioe;
130+
}
131+
126132
/**
127133
* Placeholder until we address bug 15786 (implementing a proper exception hierarchy).
128134
*/

src/com/rabbitmq/client/impl/AMQConnection.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,13 @@ public void start()
289289
new AMQImpl.Connection.StartOk(_clientProperties, "PLAIN",
290290
saslResponse, "en_US");
291291

292-
AMQP.Connection.Tune connTune =
293-
(AMQP.Connection.Tune) _channel0.exnWrappingRpc(startOk).getMethod();
292+
AMQP.Connection.Tune connTune = null;
293+
294+
try {
295+
connTune = (AMQP.Connection.Tune) _channel0.rpc(startOk).getMethod();
296+
} catch (ShutdownSignalException e) {
297+
throw AMQChannel.wrap(e, "Possibly caused by authentication failure");
298+
}
294299

295300
int channelMax =
296301
negotiatedMaxValue(factory.getRequestedChannelMax(),

test/src/com/rabbitmq/client/test/server/Permissions.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,21 @@ protected void withNames(WithName action)
138138
action.with("read");
139139
}
140140

141+
public void testAuth()
142+
{
143+
ConnectionFactory unAuthFactory = new ConnectionFactory();
144+
unAuthFactory.setUsername("test");
145+
unAuthFactory.setPassword("tset");
146+
147+
try {
148+
unAuthFactory.newConnection();
149+
fail("Exception expected if password is wrong");
150+
} catch (IOException e) {
151+
String msg = e.getMessage();
152+
assertTrue("Exception message should contain auth", msg.toLowerCase().contains("auth"));
153+
}
154+
}
155+
141156
public void testExchangeConfiguration()
142157
throws IOException
143158
{

0 commit comments

Comments
 (0)