Example #1
0
  private Transport newTransport(ConnectorConfig config) throws ConnectionException {
    if (config.getTransportFactory() != null) {
      Transport t = config.getTransportFactory().createTransport();
      t.setConfig(config);
      return t;
    }

    try {
      Transport t = (Transport) config.getTransport().newInstance();
      t.setConfig(config);
      return t;
    } catch (InstantiationException e) {
      throw new ConnectionException("Failed to create new Transport " + config.getTransport());
    } catch (IllegalAccessException e) {
      throw new ConnectionException("Failed to create new Transport " + config.getTransport());
    }
  }