@Override
  public Connection connect(URI uri, Properties properties) throws ConnectionException {

    if (PASSTHROUGH.equals(uri.getScheme())) {
      if (STRIPES.containsKey(uri.getAuthority())) {
        String serverName = uri.getHost();
        PassthroughServer server =
            PassthroughServerRegistry.getSharedInstance().getServerForName(serverName);
        if (null != server) {
          String connectionName = properties.getProperty("connection.name");
          if (null == connectionName) {
            connectionName = "Ehcache:ACTIVE-PASSIVE";
          }

          Connection connection = server.connectNewClient(connectionName);
          STRIPES.get(uri.getAuthority()).add(connection);
          return connection;
        }
      } else {
        throw new IllegalArgumentException(
            "UnitTestConnectionService failed to find stripe" + uri.getAuthority());
      }
    }

    checkURI(uri);

    ServerDescriptor serverDescriptor = SERVERS.get(uri);
    if (serverDescriptor == null) {
      throw new IllegalArgumentException("No server available for " + uri);
    }

    String name = properties.getProperty(ConnectionPropertyNames.CONNECTION_NAME);
    if (name == null) {
      name = "Ehcache:UNKNOWN";
    }
    Connection connection = serverDescriptor.server.connectNewClient(name);
    serverDescriptor.add(connection, properties);

    LOGGER.info("Client opened {} to PassthroughServer at {}", formatConnectionId(connection), uri);

    /*
     * Uses a Proxy around Connection so closed connections can be removed from the ServerDescriptor.
     */
    return (Connection)
        Proxy.newProxyInstance(
            Connection.class.getClassLoader(),
            new Class[] {Connection.class},
            new ConnectionInvocationHandler(serverDescriptor, connection));
  }