File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed
src/com/rabbitmq/client/impl
test/src/com/rabbitmq/client/test/server Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,11 @@ 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 , ex );
128+ return ioe ;
129+ }
130+
126131 /**
127132 * Placeholder until we address bug 15786 (implementing a proper exception hierarchy).
128133 */
Original file line number Diff line number Diff line change @@ -299,8 +299,13 @@ public void start(boolean insist)
299299 new AMQImpl .Connection .StartOk (_clientProperties , "PLAIN" ,
300300 saslResponse , "en_US" );
301301
302- AMQP .Connection .Tune connTune =
303- (AMQP .Connection .Tune ) _channel0 .exnWrappingRpc (startOk ).getMethod ();
302+ AMQP .Connection .Tune connTune = null ;
303+
304+ try {
305+ connTune = (AMQP .Connection .Tune ) _channel0 .rpc (startOk ).getMethod ();
306+ } catch (ShutdownSignalException e ) {
307+ throw AMQChannel .wrap (e , "Possibly caused by authentication failure" );
308+ }
304309
305310 int channelMax =
306311 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