@Test
 public void testUrlWithProvider() throws Exception {
   EndpointURI url = new MuleEndpointURI("vm://some.queue?endpointName=vmProvider", muleContext);
   url.initialise();
   assertEquals(VMConnector.VM, url.getScheme());
   assertEquals("some.queue", url.getAddress());
   assertEquals("vmProvider", url.getEndpointName());
   assertEquals("vm://some.queue?endpointName=vmProvider", url.toString());
   assertEquals(1, url.getParams().size());
 }
  /** Returns an initialized connector. */
  public Connector getOrCreateConnectorByProtocol(EndpointURI uri)
      throws TransportFactoryException {
    String connectorName = uri.getConnectorName();
    if (null != connectorName) {
      // TODO this lookup fails currently on Mule 2.x! MuleAdminAgentTestCase
      Connector connector = muleContext.getRegistry().lookupConnector(connectorName);
      if (connector != null) {
        return connector;
      }
    }

    Connector connector = getConnectorByProtocol(uri.getFullScheme());
    if (connector == null) {
      connector = createConnector(uri);
      try {
        BeanUtils.populate(connector, uri.getParams());
        muleContext.getRegistry().registerConnector(connector);
      } catch (Exception e) {
        throw new TransportFactoryException(e);
      }
    }
    return connector;
  }