@@ -52,7 +52,6 @@ public class Permissions extends BrokerTestCase
5252{
5353
5454 protected Channel adminCh ;
55- protected Connection noAccessConn ;
5655 protected Channel noAccessCh ;
5756
5857 public Permissions ()
@@ -128,8 +127,7 @@ public void with(String name) throws IOException {
128127 factory .setUsername ("noaccess" );
129128 factory .setPassword ("test" );
130129 factory .setVirtualHost ("/test" );
131- noAccessConn = factory .newConnection ();
132- noAccessCh = noAccessConn .createChannel ();
130+ noAccessCh = factory .newConnection ().createChannel ();
133131 }
134132
135133 protected void releaseResources ()
@@ -141,6 +139,7 @@ public void with(String name) throws IOException {
141139 adminCh .exchangeDelete (name );
142140 }});
143141 adminCh .getConnection ().abort ();
142+ noAccessCh .geConnection ().abort ();
144143 }
145144
146145 protected void withNames (WithName action )
@@ -321,8 +320,15 @@ protected void expectExceptionRun(int exceptionCode, WithName action)
321320 action .with ("" );
322321 fail ();
323322 } catch (IOException e ) {
324- noAccessCh = noAccessConn .createChannel ();
325- checkShutdownSignal (exceptionCode , e );
323+ ShutdownSignalException sse = (ShutdownSignalException )e .getCause ();
324+ if (sse .isHardError ()) {
325+ fail ("Got a hard-error. Was expecting soft-error: " + exceptionCode );
326+ } else {
327+ AMQP .Channel .Close closeMethod =
328+ (AMQP .Channel .Close ) ((Command )sse .getReason ()).getMethod ();
329+ assertEquals (exceptionCode , closeMethod .getReplyCode ());
330+ }
331+ noAccessCh = noAccessCh .getConnection ().createChannel ();
326332 }
327333 }
328334
0 commit comments