     (if (contains? provider-data :request-filter) (.setRequestFilter provider (.wrap verifier (eval (:request-filter provider-data)))))
     (if (contains? provider-data :state-change-request-filter) (.setStateChangeRequestFilter provider (.wrap verifier (eval (:state-change-request-filter provider-data)))))
     (if (contains? provider-data :create-client) (.setCreateClient provider (.wrap verifier (eval (:create-client provider-data)))))
-    ;def startProviderTask
-    ;def terminateProviderTask
+
+    (if (contains? provider-data :start-provider-task) (.setStartProviderTask provider (wrap-task verifier (:start-provider-task provider-data))))
+    (if (contains? provider-data :terminate-provider-task) (.setTerminateProviderTask provider (wrap-task verifier (:terminate-provider-task provider-data))))
     provider))
 
 (defn to-consumer [consumer-info]

    (if (contains? consumer-data :packages-to-scan) (.setPackagesToScan consumer (:packages-to-scan consumer-data)))
    consumer))

(defn verify-providers [verifier providers]
  (let [failures (mapcat #(let [provider (to-provider verifier %)
                           consumers (->> % val :has-pact-with (map to-consumer))]
      (.setConsumers provider consumers)
      (.verifyProvider verifier provider)) providers)]
    (if (not-empty failures)
      (do
        (.displayFailures verifier failures)

(ns au.com.dius.pact.provider.lein.verify-provider
  (:require [clojure.pprint :as pp]
            [clojure.java.io :as io]
            [clojure.string :as str]
            [leiningen.core.main :as lein])
  (:import (au.com.dius.pact.provider ProviderInfo ConsumerInfo)))

(defn wrap-task [verifier task-name]
  #(lein/resolve-and-apply (.getProject verifier) [task-name]))

(defn to-provider [verifier provider-info]
  (let [provider (ProviderInfo. (-> provider-info key str))
