func MakeWithService(t *testing.T, testName, caseName string, serviceInstance service.Service) Server {
	tempDir, tmpDirCleanup := comtesting.GetTempDir(testName)
	defer tmpDirCleanup()
	p := path.Join(tempDir, caseName+".sqlite")
	ds, err := sqlite.MakeDatastore(p)
	if err != nil {
		t.Fatal(err)
	}
	log.Infof("Created database: %s", p)
	serviceFactory := func(conf *spb.ServiceConfig) (service.Service, error) {
		return serviceInstance, nil
	}
	var testServer Server
	s, err := server.MakeServer(
		&spb.ServerConfig{
			Services: []*spb.ServiceConfig{{
				Name:           "TestService",
				Factory:        "CustomFactory",
				MaxParallelism: 5,
			}},
		},
		server.Components{
			Datastore:        ds,
			ServiceFactories: map[string]service.Factory{"CustomFactory": serviceFactory},
			Communicators:    []comms.Communicator{FakeCommunicator{&testServer}},
		})
	if err != nil {
		t.Fatal(err)
	}
	testServer.S = s
	testServer.DS = ds
	return testServer
}
MakeWithService creates a server.Server using the provided service. Like in Make(), a sqlite
datastore is created for the provided test-case.
package testserver
import (
	"context"
	"crypto"
	"crypto/rand"
	"crypto/rsa"
	"net"
	"path"
	"testing"
	"time"
	log "github.com/golang/glog"
	"github.com/golang/protobuf/proto"
	"github.com/google/fleetspeak/fleetspeak/src/common"
	"github.com/google/fleetspeak/fleetspeak/src/comtesting"
	"github.com/google/fleetspeak/fleetspeak/src/server"
	"github.com/google/fleetspeak/fleetspeak/src/server/comms"
	"github.com/google/fleetspeak/fleetspeak/src/server/service"
	"github.com/google/fleetspeak/fleetspeak/src/server/sqlite"
	fspb "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak"
	spb "github.com/google/fleetspeak/fleetspeak/src/server/proto/fleetspeak_server"
)
type Server struct {
	S  *server.Server
	DS *sqlite.Datastore
	CC comms.Context
}
type FakeCommunicator struct {
	Dest *Server
}
func (c FakeCommunicator) Setup(cc comms.Context) error {
	c.Dest.CC = cc
	return nil
}
func (c FakeCommunicator) Start() error { return nil }
func (c FakeCommunicator) Stop() {}
func Make(t *testing.T, testName, caseName string, comms []comms.Communicator) Server {
	tempDir, tmpDirCleanup := comtesting.GetTempDir(testName)
	defer tmpDirCleanup()
	p := path.Join(tempDir, caseName+".sqlite")
	ds, err := sqlite.MakeDatastore(p)
	if err != nil {
		t.Fatal(err)
	}
	log.Infof("Created database: %s", p)
	var ret Server
	s, err := server.MakeServer(
		&spb.ServerConfig{
			Services: []*spb.ServiceConfig{{
				Name:           "TestService",
				Factory:        "NOOP",
				MaxParallelism: 5,
			}},
		},
		server.Components{
			Datastore:        ds,
			ServiceFactories: map[string]service.Factory{"NOOP": service.NOOPFactory},
			Communicators:    append(comms, FakeCommunicator{&ret}),
		})
	if err != nil {
		t.Fatal(err)
	}
	ret.S = s
	ret.DS = ds
	return ret
}