syncbase: Change many uses of v23.NewServer to use xrpc.New*Server instead.

This is designed to reduce boilerplate and prove out the xrpc interface.
All but about 10 uses were replaced.

Some of the remaining calls are more complicated because the services/dispatchers
currently take the serving address as a construction parameter.

MultiPart: 9/9

Change-Id: I77495dc1ba01a93aedf0bf81f3b4f4ae268c2ef5
diff --git a/services/syncbase/syncbased/main.go b/services/syncbase/syncbased/main.go
index df96244..a75b471 100644
--- a/services/syncbase/syncbased/main.go
+++ b/services/syncbase/syncbased/main.go
@@ -19,6 +19,7 @@
 	"v.io/syncbase/x/ref/services/syncbase/server"
 	"v.io/x/ref/lib/security/securityflag"
 	"v.io/x/ref/lib/signals"
+	"v.io/x/ref/lib/xrpc"
 	_ "v.io/x/ref/runtime/factories/generic"
 )
 
@@ -44,26 +45,16 @@
 	ctx, shutdown := v23.Init()
 	defer shutdown()
 
-	s, err := v23.NewServer(ctx)
-	if err != nil {
-		vlog.Fatal("v23.NewServer() failed: ", err)
-	}
-	if _, err := s.Listen(v23.GetListenSpec(ctx)); err != nil {
-		vlog.Fatal("s.Listen() failed: ", err)
-	}
-
 	perms, err := securityflag.PermissionsFromFlag()
 	if err != nil {
 		vlog.Fatal("securityflag.PermissionsFromFlag() failed: ", err)
 	}
-
 	if perms != nil {
 		vlog.Info("Using permissions from command line flag.")
 	} else {
 		vlog.Info("No permissions flag provided. Giving local principal all permissions.")
 		perms = defaultPerms(security.DefaultBlessingPatterns(v23.GetPrincipal(ctx)))
 	}
-
 	service, err := server.NewService(nil, nil, server.ServiceOptions{
 		Perms:   perms,
 		RootDir: *rootDir,
@@ -74,9 +65,8 @@
 	}
 	d := server.NewDispatcher(service)
 
-	// Publish the service in the mount table.
-	if err := s.ServeDispatcher(*name, d); err != nil {
-		vlog.Fatal("s.ServeDispatcher() failed: ", err)
+	if _, err = xrpc.NewDispatchingServer(ctx, *name, d); err != nil {
+		vlog.Fatal("xrpc.NewDispatchingServer() failed: ", err)
 	}
 	vlog.Info("Mounted at: ", *name)