func (c *FakeConnector) GetResource(id manifold.ID) *db.Resource {
	return c.DB.GetResource(id)
}
GetResource returns a Resource for the ID or nil
package connector
import (
	"crypto/rand"
	"errors"
	"fmt"
	"net/http"
	"sync"
	"time"
	"github.com/go-zoo/bone"
	"github.com/manifoldco/go-base32"
	"github.com/manifoldco/go-connector"
	cerrors "github.com/manifoldco/go-connector/errors"
	"github.com/manifoldco/go-manifold"
	"github.com/manifoldco/go-manifold/idtype"
	"github.com/manifoldco/grafton/db"
)
var ErrCallbackNotFound = errors.New("Callback Not Found")
var ErrCallbackAlreadyResolved = errors.New("Callback Already Resolved")
var ErrResourceNotFound = errors.New("Resource Not Found")
type RequestCapturer struct {
	Route    string
	requests []interface{}
}
func (r *RequestCapturer) capture(v interface{}) {
	r.requests = append(r.requests, v)
}
func (r *RequestCapturer) Get() []interface{} {
	return r.requests
}
type FakeConnectorConfig struct {
	Product      string
	Port         uint
	ClientID     string
	ClientSecret string
	SigningKey   string
}
type FakeConnector struct {
	Config     *FakeConnectorConfig
	DB         *db.DB
	OnCallback chan *Callback
	capturers  map[string]*RequestCapturer
	codes      []*AuthorizationCode
	tokens     []*AccessToken
	callbacks  []*Callback
	Server     *http.Server
}
func (c *FakeConnector) StartSync() error {
	h := ValidHandler(c)
	c.Server = &http.Server{
		Addr:    fmt.Sprintf("localhost:%d", c.Config.Port),
		Handler: h,
	}
	return c.Server.ListenAndServe()
}
func (c *FakeConnector) Start() {
	h := ValidHandler(c)
	c.Server = &http.Server{
		Addr:    fmt.Sprintf("localhost:%d", c.Config.Port),
		Handler: h,
	}
	go c.Server.ListenAndServe()
}
func (c *FakeConnector) Stop() error {
	if c.Server == nil {
		return errors.New("Cannot not stop a server that has not started")
	}
	close(c.OnCallback)
	return c.Server.Close()
}
func (c *FakeConnector) GetCapturer(route string) (*RequestCapturer, error) {
	capturer, ok := c.capturers[route]
	if !ok {
		return nil, errors.New("No Capturer found")
	}
	return capturer, nil
}
func (c *FakeConnector) AddResource(r *db.Resource) {
	c.DB.PutResource(*r)
}
func (c *FakeConnector) RemoveResource(ID manifold.ID) error {
	if c.DB.DeleteResource(ID) {
		return nil
	}
	return ErrResourceNotFound
}