File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed
src/com/rabbitmq/client/impl
test/src/com/rabbitmq/client/test/server Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff 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 */
Original file line number Diff line number Diff 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 (),
Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments