setExpectedException('JsonRpc\Exception\AuthenticationFailureException'); $middlewareHandler = new MiddlewareHandler(); $middlewareHandler->withUsername('myUsername'); $middlewareHandler->withPassword('myPassword'); $middlewareHandler->withProcedure('myProcedure'); $middlewareHandler->withMiddleware(new FirstMiddleware()); $middlewareHandler->withMiddleware(new SecondMiddleware()); $middlewareHandler->execute(); } }