String expectedFailingConnector,
String serviceName)
{
// Declare countdown latch and listener
final CountDownLatch latch = new CountDownLatch(1);
SystemExceptionHandler listener = null;
MessagingExceptionHandler messagingListener = null;
MuleClient muleClient = p.getMuleClient();
boolean localMuleClient = muleClient == null;
SystemExceptionHandler currentExceptionListener = null;
MessagingExceptionHandler currentMessagingListener = null;
final ValueHolder<Exception> exceptionHolder = new ValueHolder<Exception>();
try
{
// First create a local muleClient instance if not supplied
if (localMuleClient) muleClient = new MuleClient(muleContext);
// Next create a listener that listens for exception on the
// sftp-connector
listener = new SystemExceptionHandler()
{
public void handleException(Exception e, RollbackMethod rollbackMethod)
{
exceptionHolder.value = e;
if (logger.isDebugEnabled())