veyron/jni: remove java files from the Veyron main repo.

Change-Id: I8886c8c8653d044d469351e3a19240e085128b46
diff --git a/jni/runtimes/google/android.go b/jni/runtimes/google/android.go
deleted file mode 100644
index d8ecb99..0000000
--- a/jni/runtimes/google/android.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// +build android
-
-package main
-
-//TODO(bprosnitz) Move android code to a separate package so that we can make dependencies work
-
-import "syscall"
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-// #include <stdlib.h>
-import "C"
-
-//export Java_com_veyron_runtimes_google_android_RedirectStderr_nativeStart
-func Java_com_veyron_runtimes_google_android_RedirectStderr_nativeStart(env *C.JNIEnv, jRuntime C.jclass, fileno C.jint) {
-	syscall.Dup2(int(fileno), syscall.Stderr)
-}
diff --git a/jni/runtimes/google/ipc/arg_getter.go b/jni/runtimes/google/ipc/arg_getter.go
deleted file mode 100644
index b57a2e7..0000000
--- a/jni/runtimes/google/ipc/arg_getter.go
+++ /dev/null
@@ -1,291 +0,0 @@
-package ipc
-
-import (
-	"fmt"
-	"path"
-	"reflect"
-
-	"veyron.io/proximity/api/services/proximity"
-
-	// Imported VDLs.  Please add a link to all VDLs you care about here,
-	// and add all interfaces you care about to the init() function below.
-	"veyron/examples/fortune"
-
-	ctx "veyron2/context"
-	"veyron2/ipc"
-)
-
-func init() {
-	registerInterface((*fortune.Fortune)(nil))
-	registerInterface((*fortune.FortuneService)(nil))
-	registerInterface((*proximity.Proximity)(nil))
-	registerInterface((*proximity.ProximityService)(nil))
-	registerInterface((*proximity.ProximityScanner)(nil))
-	registerInterface((*proximity.ProximityScannerService)(nil))
-	registerInterface((*proximity.ProximityAnnouncer)(nil))
-	registerInterface((*proximity.ProximityAnnouncerService)(nil))
-}
-
-// A list of all registered serviceArgGetter-s.
-var register map[string]*serviceArgGetter = make(map[string]*serviceArgGetter)
-
-// registerInterface registers the provided VDL client or server interface
-// so that its methods' arguments can be created on-the-fly.
-func registerInterface(ifacePtr interface{}) {
-	t := reflect.TypeOf(ifacePtr)
-	if t.Kind() != reflect.Ptr {
-		panic(fmt.Sprintf("expected pointer type for %q, got: %v", ifacePtr, t.Kind()))
-	}
-	t = t.Elem()
-	if t.Kind() != reflect.Interface {
-		panic(fmt.Sprintf("expected interface type for %q, got: %v", ifacePtr, t.Kind()))
-	}
-
-	contextType := reflect.TypeOf((*ctx.T)(nil)).Elem()
-	serverContextType := reflect.TypeOf((*ipc.ServerContext)(nil)).Elem()
-	optType := reflect.TypeOf(([]ipc.CallOpt)(nil))
-	// Create a new arg getter.
-	methods := make(map[string][]*methodArgs)
-	for i := 0; i < t.NumMethod(); i++ {
-		m := t.Method(i)
-		var mArgs methodArgs
-		for j := 0; j < m.Type.NumIn(); j++ {
-			argType := m.Type.In(j)
-			if j == 0 {
-				if argType == contextType || argType == serverContextType {
-					// context arguments - ignore them.
-					continue
-				}
-			}
-			if j == m.Type.NumIn()-1 {
-				if argType.Kind() == reflect.Interface { // (service) stream argument.
-					if err := fillStreamArgs(argType, &mArgs); err != nil {
-						panic(err.Error())
-					}
-					continue
-				}
-				if argType == optType { // (client) CallOption argument - ignore it.
-					continue
-				}
-			}
-			mArgs.inTypes = append(mArgs.inTypes, argType)
-		}
-		for j := 0; j < m.Type.NumOut()-1; j++ {
-			argType := m.Type.Out(j)
-			if j == 0 && argType.Kind() == reflect.Interface { // (client) stream argument
-				if err := fillStreamArgs(argType, &mArgs); err != nil {
-					panic(err.Error())
-				}
-				continue
-			}
-			mArgs.outTypes = append(mArgs.outTypes, argType)
-		}
-		methods[m.Name] = append(methods[m.Name], &mArgs)
-	}
-	path := path.Join(t.PkgPath(), t.Name())
-	register[path] = &serviceArgGetter{
-		methods: methods,
-		vdlPath: path,
-	}
-}
-
-// fillStreamArgs fills in stream argument types for the provided stream.
-func fillStreamArgs(stream reflect.Type, mArgs *methodArgs) error {
-	// Get the stream send type.
-	if mSendStream, ok := stream.MethodByName("SendStream"); ok {
-		if mSendStream.Type.NumOut() != 1 {
-			return fmt.Errorf("Illegal number of arguments for SendStream method in stream %v", stream)
-		}
-		mSend, ok := mSendStream.Type.Out(0).MethodByName("Send")
-		if !ok {
-			return fmt.Errorf("Illegal Send method in SendStream %v", mSendStream)
-		}
-
-		if mSend.Type.NumIn() != 1 {
-			return fmt.Errorf("Illegal number of arguments for Send method in stream %v", stream)
-		}
-		mArgs.streamSendType = mSend.Type.In(0)
-	}
-	// Get the stream recv type.
-	if mRecvStream, ok := stream.MethodByName("RecvStream"); ok {
-		if mRecvStream.Type.NumOut() != 1 {
-			return fmt.Errorf("Illegal number of arguments for RecvStream method in stream %v", stream)
-		}
-		mRecv, ok := mRecvStream.Type.Out(0).MethodByName("Value")
-		if !ok {
-			return fmt.Errorf("Illegal Value method in RecvStream %v", mRecvStream)
-		}
-		if mRecv.Type.NumOut() != 1 {
-			return fmt.Errorf("Illegal number of arguments for Value method in stream %v", stream)
-		}
-		mArgs.streamRecvType = mRecv.Type.Out(0)
-	}
-	if mArgs.streamSendType == nil && mArgs.streamRecvType == nil {
-		return fmt.Errorf("Both stream in and out arguments cannot be nil in stream %v", stream)
-	}
-	// Get the stream finish types.
-	if mFinish, ok := stream.MethodByName("Finish"); ok && mFinish.Type.NumOut() > 1 {
-		for i := 0; i < mFinish.Type.NumOut()-1; i++ {
-			mArgs.streamFinishTypes = append(mArgs.streamFinishTypes, mFinish.Type.Out(i))
-		}
-	}
-	return nil
-}
-
-// serviceArgGetter serves method arguments for a specific service.
-type serviceArgGetter struct {
-	methods map[string][]*methodArgs
-	vdlPath string
-}
-
-func (sag *serviceArgGetter) String() (ret string) {
-	ret = "VDLPath: " + sag.vdlPath
-	for k, v := range sag.methods {
-		for _, m := range v {
-			ret += "; "
-			ret += fmt.Sprintf("Method: %s, Args: %v", k, m)
-		}
-	}
-	return
-}
-
-// argGetter serves method arguments for a service object.
-// (which may implement multiple services)
-type argGetter struct {
-	methods map[string][]*methodArgs
-}
-
-// newArgGetter returns the argument getter for the provided service object.
-func newArgGetter(paths []string) (*argGetter, error) {
-	ag := &argGetter{
-		methods: make(map[string][]*methodArgs),
-	}
-	for _, path := range paths {
-		sag := register[path]
-		if sag == nil {
-			return nil, fmt.Errorf("unknown service %s", path)
-		}
-		for method, args := range sag.methods {
-			ag.methods[method] = args
-		}
-	}
-	return ag, nil
-}
-
-func (ag *argGetter) String() (ret string) {
-	for k, v := range ag.methods {
-		for _, m := range v {
-			ret += "; "
-			ret += fmt.Sprintf("Method: %s, Args: %v", k, m)
-		}
-	}
-	return
-}
-
-// FindMethod returns the method type information for the given method, or nil if
-// the method doesn't exist.
-func (ag *argGetter) FindMethod(method string, numInArgs int) *methodArgs {
-	ms, ok := ag.methods[method]
-	if !ok {
-		return nil
-	}
-	var m *methodArgs
-	for _, mi := range ms {
-		if len(mi.inTypes) == numInArgs {
-			m = mi
-			break
-		}
-	}
-	return m
-}
-
-// method contains argument type information for a method belonging to an interface.
-type methodArgs struct {
-	inTypes           []reflect.Type
-	outTypes          []reflect.Type
-	streamSendType    reflect.Type
-	streamRecvType    reflect.Type
-	streamFinishTypes []reflect.Type
-}
-
-func (m *methodArgs) String() string {
-	in := fmt.Sprintf("[%d]", len(m.inTypes))
-	out := fmt.Sprintf("[%d]", len(m.outTypes))
-	streamFinish := fmt.Sprintf("[%d]", len(m.streamFinishTypes))
-	streamSend := "<nil>"
-	streamRecv := "<nil>"
-	for idx, t := range m.inTypes {
-		if idx > 0 {
-			in += ", "
-		}
-		in += t.Name()
-	}
-	for idx, t := range m.outTypes {
-		if idx > 0 {
-			out += ", "
-		}
-		out += t.Name()
-	}
-	if m.streamSendType != nil {
-		streamSend = m.streamSendType.Name()
-	}
-	if m.streamRecvType != nil {
-		streamRecv = m.streamRecvType.Name()
-	}
-	for idx, t := range m.streamFinishTypes {
-		if idx > 0 {
-			streamFinish += ", "
-		}
-		streamFinish += t.Name()
-	}
-	return fmt.Sprintf("(In: %s; Out: %s; streamSend: %s; StreamRecv: %s; StreamFinish: %s)", in, out, streamSend, streamRecv, streamFinish)
-}
-
-func (m *methodArgs) IsStreaming() bool {
-	return m.streamSendType != nil || m.streamRecvType != nil
-}
-
-// GenInPtrs returns pointers to instances of all input arguments.
-func (m *methodArgs) InPtrs() []interface{} {
-	argptrs := make([]interface{}, len(m.inTypes))
-	for i, arg := range m.inTypes {
-		argptrs[i] = newPtrInstance(arg)
-	}
-	return argptrs
-}
-
-// OutPtrs returns pointers to instances of all output arguments.
-func (m *methodArgs) OutPtrs() []interface{} {
-	argptrs := make([]interface{}, len(m.outTypes))
-	for i, arg := range m.outTypes {
-		argptrs[i] = newPtrInstance(arg)
-	}
-	return argptrs
-}
-
-// StreamSendPtr returns a pointer to an instance of a stream send type.
-func (m *methodArgs) StreamSendPtr() interface{} {
-	return newPtrInstance(m.streamSendType)
-}
-
-// StreamRecvPtr returns a pointer to an instance of a stream recv type.
-func (m *methodArgs) StreamRecvPtr() interface{} {
-	return newPtrInstance(m.streamRecvType)
-}
-
-// StreamFinishPtrs returns pointers to instances of stream finish types.
-func (m *methodArgs) StreamFinishPtrs() []interface{} {
-	argptrs := make([]interface{}, len(m.streamFinishTypes))
-	for i, arg := range m.streamFinishTypes {
-		argptrs[i] = newPtrInstance(arg)
-	}
-	return argptrs
-}
-
-// newPtrInstance returns the pointer to the new instance of the provided type.
-func newPtrInstance(t reflect.Type) interface{} {
-	if t == nil {
-		return nil
-	}
-	return reflect.New(t).Interface()
-}
diff --git a/jni/runtimes/google/ipc/arg_getter_test.go b/jni/runtimes/google/ipc/arg_getter_test.go
deleted file mode 100644
index 577a20e..0000000
--- a/jni/runtimes/google/ipc/arg_getter_test.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package ipc
-
-import (
-	"reflect"
-	"testing"
-
-	"veyron2/vdl/test_base"
-)
-
-func init() {
-	registerInterface((*test_base.ServiceB)(nil))
-}
-
-func compareType(t *testing.T, method string, got, want interface{}, argKind string) {
-	if gotT, wantT := reflect.TypeOf(got), reflect.TypeOf(want); gotT != wantT {
-		t.Errorf("type mismatch in %q's %s argument: got %v , want %v ", method, argKind, gotT, wantT)
-	}
-}
-
-func compareTypes(t *testing.T, method string, got, want []interface{}, argKind string) {
-	if len(got) != len(want) {
-		t.Errorf("mismatch in input arguments: got %v , want %v ", got, want)
-	}
-	for i, _ := range got {
-		compareType(t, method, got[i], want[i], argKind)
-	}
-}
-
-func TestGetter(t *testing.T) {
-	iface := "veyron2/vdl/test_base/ServiceB"
-	getter, err := newArgGetter([]string{iface})
-	if err != nil {
-		t.Fatalf("couldn't find getter for interface: %v ", iface)
-	}
-	data := []struct {
-		Method       string
-		NumInArgs    int
-		in, out      []interface{}
-		sSend, sRecv interface{}
-		sFinish      []interface{}
-	}{
-		{"MethodA1", 0, nil, nil, nil, nil, nil},
-		{"MethodA2", 2, []interface{}{(*int32)(nil), (*string)(nil)}, []interface{}{(*string)(nil)}, nil, nil, nil},
-		{"MethodA3", 1, []interface{}{(*int32)(nil)}, nil, nil, (*test_base.Scalars)(nil), []interface{}{(*string)(nil)}},
-		{"MethodA4", 1, []interface{}{(*int32)(nil)}, nil, (*int32)(nil), (*string)(nil), nil},
-		{"MethodB1", 2, []interface{}{(*test_base.Scalars)(nil), (*test_base.Composites)(nil)}, []interface{}{(*test_base.CompComp)(nil)}, nil, nil, nil},
-	}
-	for _, d := range data {
-		m := getter.FindMethod(d.Method, d.NumInArgs)
-		if m == nil {
-			t.Errorf("couldn't find method %q with %d args", d.Method, d.NumInArgs)
-			continue
-		}
-		// Compare arguments.
-		compareTypes(t, d.Method, m.InPtrs(), d.in, "input")
-		compareTypes(t, d.Method, m.OutPtrs(), d.out, "output")
-		compareType(t, d.Method, m.StreamSendPtr(), d.sSend, "stream send")
-		compareType(t, d.Method, m.StreamRecvPtr(), d.sRecv, "stream recv")
-		compareTypes(t, d.Method, m.StreamFinishPtrs(), d.sFinish, "stream finish")
-	}
-}
diff --git a/jni/runtimes/google/ipc/client.go b/jni/runtimes/google/ipc/client.go
deleted file mode 100644
index d1a0998..0000000
--- a/jni/runtimes/google/ipc/client.go
+++ /dev/null
@@ -1,135 +0,0 @@
-// +build android
-
-package ipc
-
-import (
-	"encoding/json"
-	"fmt"
-	"strings"
-	"time"
-
-	"veyron/jni/runtimes/google/util"
-	"veyron2/ipc"
-	"veyron2/rt"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include <stdlib.h>
-// #include "jni_wrapper.h"
-import "C"
-
-type client struct {
-	client ipc.Client
-}
-
-func newClient(c ipc.Client) *client {
-	return &client{
-		client: c,
-	}
-}
-
-// TODO(mattr): Remove the jTimeout param. after we move deadlines to contexts on java.
-func (c *client) StartCall(env *C.JNIEnv, jContext C.jobject, name, method string, jArgs C.jobjectArray, jPath C.jstring, jTimeout C.jlong) (*clientCall, error) {
-	// NOTE(spetrovic): In the long-term, we will decode JSON arguments into an
-	// array of vom.Value instances and send this array across the wire.
-
-	// Convert Java argument array into []string.
-	argStrs := make([]string, int(C.GetArrayLength(env, C.jarray(jArgs))))
-	for i := 0; i < len(argStrs); i++ {
-		argStrs[i] = util.GoString(env, C.GetObjectArrayElement(env, jArgs, C.jsize(i)))
-	}
-	// Get argument instances that correspond to the provided method.
-	vdlPackagePath := strings.Join(strings.Split(util.GoString(env, jPath), ".")[1:], "/")
-	getter, err := newArgGetter([]string{vdlPackagePath})
-	if err != nil {
-		return nil, err
-	}
-	mArgs := getter.FindMethod(method, len(argStrs))
-	if mArgs == nil {
-		return nil, fmt.Errorf("couldn't find method %s with %d args in VDL interface at path %q", method, len(argStrs), util.GoString(env, jPath))
-	}
-	argptrs := mArgs.InPtrs()
-	if len(argptrs) != len(argStrs) {
-		return nil, fmt.Errorf("invalid number of arguments for method %s, want %d, have %d", method, len(argStrs), len(argptrs))
-	}
-	// JSON decode.
-	args := make([]interface{}, len(argptrs))
-	for i, argStr := range argStrs {
-		if err := json.Unmarshal([]byte(argStr), argptrs[i]); err != nil {
-			return nil, err
-		}
-		// Remove the pointer from the argument.  Simply *argptr[i] doesn't work
-		// as argptr[i] is of type interface{}.
-		args[i] = util.DerefOrDie(argptrs[i])
-	}
-
-	// TODO(mattr): It's not clear what needs to be done with the result of newContext.
-	// We should be getting access to the veyron context object perhaps maintained inside
-	// jContext somehow.  For now I'll create a new context with a deadline derived from
-	// jTimeout.  Eventually we should remove jTimeout altogether.
-	_, err = newContext(env, jContext)
-	if err != nil {
-		return nil, err
-	}
-	context, _ := rt.R().NewContext().WithTimeout(time.Duration(int(jTimeout)) * time.Millisecond)
-
-	// Invoke StartCall
-	call, err := c.client.StartCall(context, name, method, args)
-	if err != nil {
-		return nil, err
-	}
-	return &clientCall{
-		stream: newStream(call, mArgs),
-		call:   call,
-	}, nil
-}
-
-func (c *client) Close() {
-	c.client.Close()
-}
-
-type clientCall struct {
-	stream
-	call ipc.Call
-}
-
-func (c *clientCall) Finish(env *C.JNIEnv) (C.jobjectArray, error) {
-	var resultptrs []interface{}
-	if c.mArgs.IsStreaming() {
-		resultptrs = c.mArgs.StreamFinishPtrs()
-	} else {
-		resultptrs = c.mArgs.OutPtrs()
-	}
-	// argGetter doesn't store the (mandatory) error result, so we add it here.
-	var appErr error
-	if err := c.call.Finish(append(resultptrs, &appErr)...); err != nil {
-		// invocation error
-		return nil, fmt.Errorf("Invocation error: %v", err)
-	}
-	if appErr != nil { // application error
-		return nil, appErr
-	}
-	// JSON encode the results.
-	jsonResults := make([][]byte, len(resultptrs))
-	for i, resultptr := range resultptrs {
-		// Remove the pointer from the result.  Simply *resultptr doesn't work
-		// as resultptr is of type interface{}.
-		result := util.DerefOrDie(resultptr)
-		var err error
-		jsonResults[i], err = json.Marshal(result)
-		if err != nil {
-			return nil, fmt.Errorf("error marshalling %q into JSON", resultptr)
-		}
-	}
-
-	// Convert to Java array of C.jstring.
-	ret := C.NewObjectArray(env, C.jsize(len(jsonResults)), jStringClass, nil)
-	for i, result := range jsonResults {
-		C.SetObjectArrayElement(env, ret, C.jsize(i), C.jobject(util.JStringPtr(env, string(result))))
-	}
-	return ret, nil
-}
-
-func (c *clientCall) Cancel() {
-	c.call.Cancel()
-}
diff --git a/jni/runtimes/google/ipc/context.go b/jni/runtimes/google/ipc/context.go
deleted file mode 100644
index 0256042..0000000
--- a/jni/runtimes/google/ipc/context.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// +build android
-
-package ipc
-
-import (
-	"fmt"
-	"runtime"
-
-	"veyron/jni/runtimes/google/util"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-func newContext(env *C.JNIEnv, jContext C.jobject) (*context, error) {
-	var jVM *C.JavaVM
-	if status := C.GetJavaVM(env, &jVM); status != 0 {
-		return nil, fmt.Errorf("couldn't get Java VM from the (Java) environment")
-	}
-	// Reference Java context; it will be de-referenced when the go context
-	// created below is garbage-collected (through the finalizer callback we
-	// setup just below).
-	jContext = C.NewGlobalRef(env, jContext)
-	c := &context{
-		jVM:      jVM,
-		jContext: jContext,
-	}
-	runtime.SetFinalizer(c, func(c *context) {
-		envPtr, freeFunc := util.GetEnv(c.jVM)
-		env := (*C.JNIEnv)(envPtr)
-		defer freeFunc()
-		C.DeleteGlobalRef(env, c.jContext)
-	})
-	return c, nil
-}
-
-type context struct {
-	jVM      *C.JavaVM
-	jContext C.jobject
-}
diff --git a/jni/runtimes/google/ipc/dispatcher.go b/jni/runtimes/google/ipc/dispatcher.go
deleted file mode 100644
index 8bed4e0..0000000
--- a/jni/runtimes/google/ipc/dispatcher.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// +build android
-
-package ipc
-
-import (
-	"fmt"
-	"runtime"
-
-	isecurity "veyron/jni/runtimes/google/security"
-	"veyron/jni/runtimes/google/util"
-	"veyron2/ipc"
-	"veyron2/security"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-func newDispatcher(env *C.JNIEnv, jDispatcher C.jobject) (*dispatcher, error) {
-	// We cannot cache Java environments as they are only valid in the current
-	// thread.  We can, however, cache the Java VM and obtain an environment
-	// from it in whatever thread happens to be running at the time.
-	var jVM *C.JavaVM
-	if status := C.GetJavaVM(env, &jVM); status != 0 {
-		return nil, fmt.Errorf("couldn't get Java VM from the (Java) environment")
-	}
-	// Reference Java dispatcher; it will be de-referenced when the go
-	// dispatcher created below is garbage-collected (through the finalizer
-	// callback we setup below).
-	jDispatcher = C.NewGlobalRef(env, jDispatcher)
-	d := &dispatcher{
-		jVM:         jVM,
-		jDispatcher: jDispatcher,
-	}
-	runtime.SetFinalizer(d, func(d *dispatcher) {
-		envPtr, freeFunc := util.GetEnv(d.jVM)
-		env := (*C.JNIEnv)(envPtr)
-		defer freeFunc()
-		C.DeleteGlobalRef(env, d.jDispatcher)
-	})
-
-	return d, nil
-}
-
-type dispatcher struct {
-	jVM         *C.JavaVM
-	jDispatcher C.jobject
-}
-
-func (d *dispatcher) Lookup(suffix, method string) (ipc.Invoker, security.Authorizer, error) {
-	// Get Java environment.
-	envPtr, freeFunc := util.GetEnv(d.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-
-	// Call Java dispatcher's lookup() method.
-	serviceObjectWithAuthorizerSign := util.ClassSign("com.veyron2.ipc.ServiceObjectWithAuthorizer")
-	tempJObj, err := util.CallObjectMethod(env, d.jDispatcher, "lookup", []util.Sign{util.StringSign}, serviceObjectWithAuthorizerSign, suffix)
-	jObj := C.jobject(tempJObj)
-	if err != nil {
-		return nil, nil, fmt.Errorf("error invoking Java dispatcher's lookup() method: %v", err)
-	}
-	if jObj == nil {
-		// Lookup returned null, which means that the dispatcher isn't handling the object -
-		// this is not an error.
-		return nil, nil, nil
-	}
-
-	// Extract the Java service object and Authorizer.
-	jServiceObj := C.jobject(util.CallObjectMethodOrCatch(env, jObj, "getServiceObject", nil, util.ObjectSign))
-	if jServiceObj == nil {
-		return nil, nil, fmt.Errorf("null service object returned by Java's ServiceObjectWithAuthorizer")
-	}
-	authSign := util.ClassSign("com.veyron2.security.Authorizer")
-	jAuth := C.jobject(util.CallObjectMethodOrCatch(env, jObj, "getAuthorizer", nil, authSign))
-
-	// Create Go Invoker and Authorizer.
-	i, err := newInvoker(env, d.jVM, jServiceObj)
-	if err != nil {
-		return nil, nil, err
-	}
-	var a security.Authorizer
-	if jAuth != nil {
-		a = isecurity.NewAuthorizer(env, jAuth)
-	}
-	return i, a, nil
-}
diff --git a/jni/runtimes/google/ipc/invoker.go b/jni/runtimes/google/ipc/invoker.go
deleted file mode 100644
index c35d75e..0000000
--- a/jni/runtimes/google/ipc/invoker.go
+++ /dev/null
@@ -1,187 +0,0 @@
-// +build android
-
-package ipc
-
-import (
-	"encoding/json"
-	"fmt"
-	"runtime"
-
-	"veyron/jni/runtimes/google/util"
-	"veyron2/ipc"
-	"veyron2/security"
-	"veyron2/verror"
-)
-
-// #cgo LDFLAGS: -llog -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-func newInvoker(env *C.JNIEnv, jVM *C.JavaVM, jObj C.jobject) (*invoker, error) {
-	// Create a new Java VDLInvoker object.
-	tempJInvoker, err := util.NewObject(env, jVDLInvokerClass, []util.Sign{util.ObjectSign}, jObj)
-	jInvoker := C.jobject(tempJInvoker)
-	if err != nil {
-		return nil, fmt.Errorf("error creating Java VDLInvoker object: %v", err)
-	}
-	// Fetch the argGetter for the object.
-	jPathArray := C.jobjectArray(util.CallObjectMethodOrCatch(env, jInvoker, "getImplementedServices", nil, util.ArraySign(util.StringSign)))
-	paths := util.GoStringArray(env, jPathArray)
-	getter, err := newArgGetter(paths)
-	if err != nil {
-		return nil, err
-	}
-	// Reference Java invoker; it will be de-referenced when the go invoker
-	// created below is garbage-collected (through the finalizer callback we
-	// setup just below).
-	jInvoker = C.NewGlobalRef(env, jInvoker)
-	i := &invoker{
-		jVM:       jVM,
-		jInvoker:  jInvoker,
-		argGetter: getter,
-	}
-	runtime.SetFinalizer(i, func(i *invoker) {
-		envPtr, freeFunc := util.GetEnv(i.jVM)
-		env := (*C.JNIEnv)(envPtr)
-		defer freeFunc()
-		C.DeleteGlobalRef(env, i.jInvoker)
-	})
-	return i, nil
-}
-
-type invoker struct {
-	jVM       *C.JavaVM
-	jInvoker  C.jobject
-	argGetter *argGetter
-}
-
-func (i *invoker) Prepare(method string, numArgs int) (argptrs []interface{}, label security.Label, err error) {
-	// NOTE(spetrovic): In the long-term, this method will return an array of
-	// []vom.Value.  This will in turn result in VOM decoding all input
-	// arguments into vom.Value objects, which we shall then de-serialize into
-	// Java objects (see Invoke comments below).  This approach is blocked on
-	// pending VOM encoder/decoder changes as well as Java (de)serializer.
-	envPtr, freeFunc := util.GetEnv(i.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-
-	mArgs := i.argGetter.FindMethod(method, numArgs)
-	if mArgs == nil {
-		err = fmt.Errorf("couldn't find VDL method %q with %d args", method, numArgs)
-		return
-	}
-	argptrs = mArgs.InPtrs()
-
-	// Get the security label.
-	labelSign := util.ClassSign("com.veyron2.security.Label")
-	jLabel, err := util.CallObjectMethod(env, i.jInvoker, "getSecurityLabel", []util.Sign{util.StringSign}, labelSign, util.CamelCase(method))
-	if err != nil {
-		return nil, security.Label(0), err
-	}
-	label = security.Label(util.JIntField(env, jLabel, "value"))
-	return
-}
-
-func (i *invoker) Invoke(method string, call ipc.ServerCall, argptrs []interface{}) (results []interface{}, err error) {
-	// NOTE(spetrovic): In the long-term, all input arguments will be of
-	// vom.Value type (see comments for Prepare() method above).  Through JNI,
-	// we will call Java functions that transform a serialized vom.Value into
-	// Java objects. We will then pass those Java objects to Java's Invoke
-	// method.  The returned Java objects will be converted into serialized
-	// vom.Values, which will then be returned.  This approach is blocked on VOM
-	// encoder/decoder changes as well as Java's (de)serializer.
-	envPtr, freeFunc := util.GetEnv(i.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-
-	// Create a new Java server call instance.
-	mArgs := i.argGetter.FindMethod(method, len(argptrs))
-	if mArgs == nil {
-		err = fmt.Errorf("couldn't find VDL method %q with %d args", method, len(argptrs))
-	}
-	sCall := newServerCall(call, mArgs)
-	jServerCall := C.jobject(util.NewObjectOrCatch(env, jServerCallClass, []util.Sign{util.LongSign}, sCall))
-	util.GoRef(sCall) // unref-ed when jServerCall is garbage-collected
-
-	// Translate input args to JSON.
-	jArgs, err := i.encodeArgs(env, argptrs)
-	if err != nil {
-		return
-	}
-	// Invoke the method.
-	callSign := util.ClassSign("com.veyron2.ipc.ServerCall")
-	replySign := util.ClassSign("com.veyron.runtimes.google.VDLInvoker$InvokeReply")
-	jReply, err := util.CallObjectMethod(env, i.jInvoker, "invoke", []util.Sign{util.StringSign, callSign, util.ArraySign(util.StringSign)}, replySign, util.CamelCase(method), jServerCall, jArgs)
-	if err != nil {
-		return nil, fmt.Errorf("error invoking Java method %q: %v", method, err)
-	}
-	// Decode and return results.
-	return i.decodeResults(env, method, len(argptrs), C.jobject(jReply))
-}
-
-// encodeArgs JSON-encodes the provided argument pointers, converts them into
-// Java strings, and returns a Java string array response.
-func (*invoker) encodeArgs(env *C.JNIEnv, argptrs []interface{}) (C.jobjectArray, error) {
-	// JSON encode.
-	jsonArgs := make([][]byte, len(argptrs))
-	for i, argptr := range argptrs {
-		// Remove the pointer from the argument.  Simply *argptr doesn't work
-		// as argptr is of type interface{}.
-		arg := util.DerefOrDie(argptr)
-		var err error
-		jsonArgs[i], err = json.Marshal(arg)
-		if err != nil {
-			return nil, fmt.Errorf("error marshalling %q into JSON", arg)
-		}
-	}
-
-	// Convert to Java array of C.jstring.
-	ret := C.NewObjectArray(env, C.jsize(len(argptrs)), jStringClass, nil)
-	for i, arg := range jsonArgs {
-		C.SetObjectArrayElement(env, ret, C.jsize(i), C.jobject(util.JStringPtr(env, string(arg))))
-	}
-	return ret, nil
-}
-
-// decodeResults JSON-decodes replies stored in the Java reply object and
-// returns an array of Go reply objects.
-func (i *invoker) decodeResults(env *C.JNIEnv, method string, numArgs int, jReply C.jobject) ([]interface{}, error) {
-	// Unpack the replies.
-	results := util.JStringArrayField(env, jReply, "results")
-	hasAppErr := util.JBoolField(env, jReply, "hasApplicationError")
-	errorID := util.JStringField(env, jReply, "errorID")
-	errorMsg := util.JStringField(env, jReply, "errorMsg")
-
-	// Get result instances.
-	mArgs := i.argGetter.FindMethod(method, numArgs)
-	if mArgs == nil {
-		return nil, fmt.Errorf("couldn't find method %q with %d input args: %v", method, numArgs)
-	}
-	argptrs := mArgs.OutPtrs()
-
-	// Check for app error.
-	if hasAppErr {
-		return resultsWithError(argptrs, verror.Make(verror.ID(errorID), errorMsg)), nil
-	}
-	// JSON-decode.
-	if len(results) != len(argptrs) {
-		return nil, fmt.Errorf("mismatch in number of output arguments, have: %d want: %d", len(results), len(argptrs))
-	}
-	for i, result := range results {
-		if err := json.Unmarshal([]byte(result), argptrs[i]); err != nil {
-			return nil, err
-		}
-	}
-	return resultsWithError(argptrs, nil), nil
-}
-
-// resultsWithError dereferences the provided result pointers and appends the
-// given error to the returned array.
-func resultsWithError(resultptrs []interface{}, err error) []interface{} {
-	ret := make([]interface{}, len(resultptrs)+1)
-	for i, resultptr := range resultptrs {
-		ret[i] = util.DerefOrDie(resultptr)
-	}
-	ret[len(resultptrs)] = err
-	return ret
-}
diff --git a/jni/runtimes/google/ipc/jni.go b/jni/runtimes/google/ipc/jni.go
deleted file mode 100644
index 3f7224e..0000000
--- a/jni/runtimes/google/ipc/jni.go
+++ /dev/null
@@ -1,297 +0,0 @@
-// +build android
-
-package ipc
-
-import (
-	"io"
-	"time"
-	"unsafe"
-
-	jnisecurity "veyron/jni/runtimes/google/security"
-	"veyron/jni/runtimes/google/util"
-	"veyron2"
-	ctx "veyron2/context"
-	"veyron2/ipc"
-	"veyron2/rt"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-// #include <stdlib.h>
-import "C"
-
-var (
-	// Global reference for com.veyron.runtimes.google.ipc.Runtime$ServerCall class.
-	jServerCallClass C.jclass
-	// Global reference for com.veyron.runtimes.google.ipc.VDLInvoker class.
-	jVDLInvokerClass C.jclass
-	// Global reference for com.veyron2.OptionDefs class.
-	jOptionDefsClass C.jclass
-	// Global reference for java.io.EOFException class.
-	jEOFExceptionClass C.jclass
-	// Global reference for java.lang.String class.
-	jStringClass C.jclass
-)
-
-// Init initializes the JNI code with the given Java environment. This method
-// must be called from the main Java thread.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java environment is passed in an empty
-// interface and then cast into the package-local environment type.
-func Init(jEnv interface{}) {
-	env := (*C.JNIEnv)(unsafe.Pointer(util.PtrValue(jEnv)))
-	// Cache global references to all Java classes used by the package.  This is
-	// necessary because JNI gets access to the class loader only in the system
-	// thread, so we aren't able to invoke FindClass in other threads.
-	jServerCallClass = C.jclass(util.JFindClassPtrOrDie(env, "com/veyron/runtimes/google/Runtime$ServerCall"))
-	jVDLInvokerClass = C.jclass(util.JFindClassPtrOrDie(env, "com/veyron/runtimes/google/VDLInvoker"))
-	jOptionDefsClass = C.jclass(util.JFindClassPtrOrDie(env, "com/veyron2/OptionDefs"))
-	jEOFExceptionClass = C.jclass(util.JFindClassPtrOrDie(env, "java/io/EOFException"))
-	jStringClass = C.jclass(util.JFindClassPtrOrDie(env, "java/lang/String"))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_nativeInit
-func Java_com_veyron_runtimes_google_Runtime_nativeInit(env *C.JNIEnv, jRuntime C.jclass, jOptions C.jobject) C.jlong {
-	opts := goRuntimeOpts(env, jOptions)
-	r := rt.Init(opts...)
-	util.GoRef(&r) // Un-refed when the Java Runtime object is finalized.
-	return C.jlong(util.PtrValue(&r))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_nativeNewRuntime
-func Java_com_veyron_runtimes_google_Runtime_nativeNewRuntime(env *C.JNIEnv, jRuntime C.jclass, jOptions C.jobject) C.jlong {
-	opts := goRuntimeOpts(env, jOptions)
-	r, err := rt.New(opts...)
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jlong(0)
-	}
-	util.GoRef(&r)
-	return C.jlong(util.PtrValue(&r))
-}
-
-// goRuntimeOpts converts Java runtime options into Go runtime options.
-func goRuntimeOpts(env *C.JNIEnv, jOptions C.jobject) (ret []veyron2.ROpt) {
-	// Process RuntimeIDOpt.
-	runtimeIDKey := util.JStaticStringField(env, jOptionDefsClass, "RUNTIME_ID")
-	if util.CallBooleanMethodOrCatch(env, jOptions, "has", []util.Sign{util.StringSign}, runtimeIDKey) {
-		jPrivateID := C.jobject(util.CallObjectMethodOrCatch(env, jOptions, "get", []util.Sign{util.StringSign}, util.ObjectSign, runtimeIDKey))
-		id := jnisecurity.NewPrivateID(env, jPrivateID)
-		ret = append(ret, veyron2.RuntimeID(id))
-	}
-	// Process RuntimePublicIDStoreOpt
-	runtimePublicIDStoreKey := util.JStaticStringField(env, jOptionDefsClass, "RUNTIME_PUBLIC_ID_STORE")
-	if util.CallBooleanMethodOrCatch(env, jOptions, "has", []util.Sign{util.StringSign}, runtimePublicIDStoreKey) {
-		jStore := C.jobject(util.CallObjectMethodOrCatch(env, jOptions, "get", []util.Sign{util.StringSign}, util.ObjectSign, runtimePublicIDStoreKey))
-		store := jnisecurity.NewPublicIDStore(env, jStore)
-		ret = append(ret, veyron2.RuntimePublicIDStore(store))
-	}
-	return
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_nativeNewClient
-// TODO(mattr): Eliminate timeoutMillis, it is no longer functional.
-func Java_com_veyron_runtimes_google_Runtime_nativeNewClient(env *C.JNIEnv, jRuntime C.jobject, goRuntimePtr C.jlong, timeoutMillis C.jlong) C.jlong {
-	r := (*veyron2.Runtime)(util.Ptr(goRuntimePtr))
-	rc, err := (*r).NewClient()
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jlong(0)
-	}
-	c := newClient(rc)
-	util.GoRef(c) // Un-refed when the Java Client object is finalized.
-	return C.jlong(util.PtrValue(c))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_nativeNewServer
-func Java_com_veyron_runtimes_google_Runtime_nativeNewServer(env *C.JNIEnv, jRuntime C.jobject, goRuntimePtr C.jlong) C.jlong {
-	r := (*veyron2.Runtime)(util.Ptr(goRuntimePtr))
-	s, err := (*r).NewServer()
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jlong(0)
-	}
-	util.GoRef(&s) // Un-refed when the Java Server object is finalized.
-	return C.jlong(util.PtrValue(&s))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_nativeGetClient
-func Java_com_veyron_runtimes_google_Runtime_nativeGetClient(env *C.JNIEnv, jRuntime C.jobject, goRuntimePtr C.jlong) C.jlong {
-	r := (*veyron2.Runtime)(util.Ptr(goRuntimePtr))
-	rc := (*r).Client()
-	c := newClient(rc)
-	util.GoRef(c) // Un-refed when the Java Client object is finalized.
-	return C.jlong(util.PtrValue(c))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_nativeNewContext
-func Java_com_veyron_runtimes_google_Runtime_nativeNewContext(env *C.JNIEnv, jRuntime C.jobject, goRuntimePtr C.jlong) C.jlong {
-	r := (*veyron2.Runtime)(util.Ptr(goRuntimePtr))
-	c := (*r).NewContext()
-	util.GoRef(&c) // Un-refed when the Java context object is finalized.
-	return C.jlong(util.PtrValue(&c))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_nativeGetPublicIDStore
-func Java_com_veyron_runtimes_google_Runtime_nativeGetPublicIDStore(env *C.JNIEnv, jRuntime C.jobject, goRuntimePtr C.jlong) C.jlong {
-	r := (*veyron2.Runtime)(util.Ptr(goRuntimePtr))
-	s := (*r).PublicIDStore()
-	util.GoRef(&s) // Un-refed when the Java PublicIDStore object is finalized.
-	return C.jlong(util.PtrValue(&s))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_nativeFinalize
-func Java_com_veyron_runtimes_google_Runtime_nativeFinalize(env *C.JNIEnv, jRuntime C.jobject, goRuntimePtr C.jlong) {
-	util.GoUnref((*veyron2.Runtime)(util.Ptr(goRuntimePtr)))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024Server_nativeListen
-func Java_com_veyron_runtimes_google_Runtime_00024Server_nativeListen(env *C.JNIEnv, server C.jobject, goServerPtr C.jlong, protocol C.jstring, address C.jstring) C.jstring {
-	s := (*ipc.Server)(util.Ptr(goServerPtr))
-	ep, err := (*s).Listen(util.GoString(env, protocol), util.GoString(env, address))
-	if err != nil {
-		util.JThrowV(env, err)
-		return nil
-	}
-	return C.jstring(util.JStringPtr(env, ep.String()))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024Server_nativeServe
-func Java_com_veyron_runtimes_google_Runtime_00024Server_nativeServe(env *C.JNIEnv, jServer C.jobject, goServerPtr C.jlong, name C.jstring, jDispatcher C.jobject) {
-	s := (*ipc.Server)(util.Ptr(goServerPtr))
-	d, err := newDispatcher(env, jDispatcher)
-	if err != nil {
-		util.JThrowV(env, err)
-		return
-	}
-	if err := (*s).Serve(util.GoString(env, name), d); err != nil {
-		util.JThrowV(env, err)
-		return
-	}
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024Server_nativeGetPublishedNames
-func Java_com_veyron_runtimes_google_Runtime_00024Server_nativeGetPublishedNames(env *C.JNIEnv, jServer C.jobject, goServerPtr C.jlong) C.jobjectArray {
-	names, err := (*(*ipc.Server)(util.Ptr(goServerPtr))).Published()
-	if err != nil {
-		util.JThrowV(env, err)
-		return nil
-	}
-	ret := C.NewObjectArray(env, C.jsize(len(names)), jStringClass, nil)
-	for i, name := range names {
-		C.SetObjectArrayElement(env, ret, C.jsize(i), C.jobject(util.JStringPtr(env, string(name))))
-	}
-	return ret
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024Server_nativeStop
-func Java_com_veyron_runtimes_google_Runtime_00024Server_nativeStop(env *C.JNIEnv, server C.jobject, goServerPtr C.jlong) {
-	s := (*ipc.Server)(util.Ptr(goServerPtr))
-	if err := (*s).Stop(); err != nil {
-		util.JThrowV(env, err)
-		return
-	}
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024Server_nativeFinalize
-func Java_com_veyron_runtimes_google_Runtime_00024Server_nativeFinalize(env *C.JNIEnv, server C.jobject, goServerPtr C.jlong) {
-	util.GoUnref((*ipc.Server)(util.Ptr(goServerPtr)))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024Client_nativeStartCall
-func Java_com_veyron_runtimes_google_Runtime_00024Client_nativeStartCall(env *C.JNIEnv, jClient C.jobject, goClientPtr C.jlong, jContext C.jobject, name C.jstring, method C.jstring, jsonArgs C.jobjectArray, jPath C.jstring, timeoutMillis C.jlong) C.jlong {
-	c := (*client)(util.Ptr(goClientPtr))
-	call, err := c.StartCall(env, jContext, util.GoString(env, name), util.GoString(env, method), jsonArgs, jPath, timeoutMillis)
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jlong(0)
-	}
-	util.GoRef(call)
-	return C.jlong(util.PtrValue(call))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024Client_nativeClose
-func Java_com_veyron_runtimes_google_Runtime_00024Client_nativeClose(env *C.JNIEnv, jClient C.jobject, goClientPtr C.jlong) {
-	(*client)(util.Ptr(goClientPtr)).Close()
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024Client_nativeFinalize
-func Java_com_veyron_runtimes_google_Runtime_00024Client_nativeFinalize(env *C.JNIEnv, jClient C.jobject, goClientPtr C.jlong) {
-	util.GoUnref((*client)(util.Ptr(goClientPtr)))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024Context_nativeFinalize
-func Java_com_veyron_runtimes_google_Runtime_00024Context_nativeFinalize(env *C.JNIEnv, jClient C.jobject, goContextPtr C.jlong) {
-	util.GoUnref((*ctx.T)(util.Ptr(goContextPtr)))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024Stream_nativeSend
-func Java_com_veyron_runtimes_google_Runtime_00024Stream_nativeSend(env *C.JNIEnv, jStream C.jobject, goStreamPtr C.jlong, jItem C.jstring) {
-	(*stream)(util.Ptr(goStreamPtr)).Send(env, jItem)
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024Stream_nativeRecv
-func Java_com_veyron_runtimes_google_Runtime_00024Stream_nativeRecv(env *C.JNIEnv, jStream C.jobject, goStreamPtr C.jlong) C.jstring {
-	ret, err := (*stream)(util.Ptr(goStreamPtr)).Recv(env)
-	if err != nil {
-		if err == io.EOF {
-			util.JThrow(env, jEOFExceptionClass, err.Error())
-			return nil
-		}
-		util.JThrowV(env, err)
-		return nil
-	}
-	return ret
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024ClientCall_nativeFinish
-func Java_com_veyron_runtimes_google_Runtime_00024ClientCall_nativeFinish(env *C.JNIEnv, jClientCall C.jobject, goClientCallPtr C.jlong) C.jobjectArray {
-	ret, err := (*clientCall)(util.Ptr(goClientCallPtr)).Finish(env)
-	if err != nil {
-		util.JThrowV(env, err)
-		return nil
-	}
-	return ret
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024ClientCall_nativeCancel
-func Java_com_veyron_runtimes_google_Runtime_00024ClientCall_nativeCancel(env *C.JNIEnv, jClientCall C.jobject, goClientCallPtr C.jlong) {
-	(*clientCall)(util.Ptr(goClientCallPtr)).Cancel()
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024ClientCall_nativeFinalize
-func Java_com_veyron_runtimes_google_Runtime_00024ClientCall_nativeFinalize(env *C.JNIEnv, jClientCall C.jobject, goClientCallPtr C.jlong) {
-	util.GoUnref((*clientCall)(util.Ptr(goClientCallPtr)))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024ServerCall_nativeBlessing
-func Java_com_veyron_runtimes_google_Runtime_00024ServerCall_nativeBlessing(env *C.JNIEnv, jServerCall C.jobject, goServerCallPtr C.jlong) C.jlong {
-	id := (*serverCall)(util.Ptr(goServerCallPtr)).Blessing()
-	util.GoRef(&id) // Un-refed when the Java PublicID object is finalized.
-	return C.jlong(util.PtrValue(&id))
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024ServerCall_nativeDeadline
-func Java_com_veyron_runtimes_google_Runtime_00024ServerCall_nativeDeadline(env *C.JNIEnv, jServerCall C.jobject, goServerCallPtr C.jlong) C.jlong {
-	s := (*serverCall)(util.Ptr(goServerCallPtr))
-	var d time.Time
-	if s == nil {
-		// Error, return current time as deadline.
-		d = time.Now()
-	} else {
-		// TODO(mattr): Deal with missing deadlines by adjusting the JAVA api to allow it.
-		d, _ = s.Deadline()
-	}
-	return C.jlong(d.UnixNano() / 1000)
-}
-
-//export Java_com_veyron_runtimes_google_Runtime_00024ServerCall_nativeClosed
-func Java_com_veyron_runtimes_google_Runtime_00024ServerCall_nativeClosed(env *C.JNIEnv, jServerCall C.jobject, goServerCallPtr C.jlong) C.jboolean {
-	s := (*serverCall)(util.Ptr(goServerCallPtr))
-	select {
-	case <-s.Done():
-		return C.JNI_TRUE
-	default:
-		return C.JNI_FALSE
-	}
-}
diff --git a/jni/runtimes/google/ipc/log_android.go b/jni/runtimes/google/ipc/log_android.go
deleted file mode 100644
index 58be953..0000000
--- a/jni/runtimes/google/ipc/log_android.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// +build android
-
-package ipc
-
-// #cgo LDFLAGS: -llog
-// #include <android/log.h>
-import "C"
-
-import (
-	"bytes"
-	"log"
-	"unsafe"
-)
-
-var ctag *C.char = C.CString("com.veyron.runtimes.google.ipc")
-
-// androidWriter writes it's output using Android's Log() function.
-type androidWriter struct {
-	buf []byte
-}
-
-func (aw *androidWriter) Write(p []byte) (n int, err error) {
-	n = len(p)
-	err = nil
-	for nlidx := bytes.IndexByte(p, '\n'); nlidx != -1; nlidx = bytes.IndexByte(p, '\n') {
-		aw.buf = append(aw.buf, p[:nlidx]...)
-		p = p[nlidx+1:]
-		aw.buf = append(aw.buf, 0)
-		cstr := (*C.char)(unsafe.Pointer(&aw.buf[0]))
-		C.__android_log_write(C.ANDROID_LOG_INFO, ctag, cstr)
-		aw.buf = aw.buf[:0]
-	}
-	aw.buf = append(aw.buf, p...)
-	return
-}
-
-func init() {
-	log.SetOutput(&androidWriter{})
-}
diff --git a/jni/runtimes/google/ipc/server_call.go b/jni/runtimes/google/ipc/server_call.go
deleted file mode 100644
index f1e8199..0000000
--- a/jni/runtimes/google/ipc/server_call.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build android
-
-package ipc
-
-import (
-	"veyron2/ipc"
-)
-
-func newServerCall(call ipc.ServerCall, mArgs *methodArgs) *serverCall {
-	return &serverCall{
-		stream:     newStream(call, mArgs),
-		ServerCall: call,
-	}
-}
-
-type serverCall struct {
-	stream
-	ipc.ServerCall
-}
diff --git a/jni/runtimes/google/ipc/stream.go b/jni/runtimes/google/ipc/stream.go
deleted file mode 100644
index aa9f253..0000000
--- a/jni/runtimes/google/ipc/stream.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// +build android
-
-package ipc
-
-import (
-	"encoding/json"
-	"fmt"
-
-	"veyron/jni/runtimes/google/util"
-	"veyron2/ipc"
-)
-
-// #include <stdlib.h>
-// #include <jni.h>
-import "C"
-
-func newStream(s ipc.Stream, mArgs *methodArgs) stream {
-	return stream{
-		stream: s,
-		mArgs:  mArgs,
-	}
-}
-
-type stream struct {
-	stream ipc.Stream
-	mArgs  *methodArgs
-}
-
-func (s *stream) Send(env *C.JNIEnv, jItem C.jstring) error {
-	argStr := util.GoString(env, jItem)
-	argptr := s.mArgs.StreamSendPtr()
-	if argptr == nil {
-		return fmt.Errorf("nil stream input argument, expected a non-nil type for argument %q", argStr)
-	}
-	if err := json.Unmarshal([]byte(argStr), argptr); err != nil {
-		return err
-	}
-	return s.stream.Send(util.DerefOrDie(argptr))
-}
-
-func (s *stream) Recv(env *C.JNIEnv) (C.jstring, error) {
-	argptr := s.mArgs.StreamRecvPtr()
-	if argptr == nil {
-		return nil, fmt.Errorf("nil stream output argument")
-	}
-	if err := s.stream.Recv(argptr); err != nil {
-		return nil, err
-	}
-	// JSON encode the result.
-	result, err := json.Marshal(util.DerefOrDie(argptr))
-	if err != nil {
-		return nil, err
-	}
-	return C.jstring(util.JStringPtr(env, string(result))), nil
-}
diff --git a/jni/runtimes/google/jni.go b/jni/runtimes/google/jni.go
deleted file mode 100644
index a79a3ae..0000000
--- a/jni/runtimes/google/jni.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// +build android
-
-package main
-
-import (
-	"flag"
-	"unsafe"
-
-	"veyron/jni/runtimes/google/ipc"
-	"veyron/jni/runtimes/google/security"
-	"veyron/jni/runtimes/google/util"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-//export JNI_OnLoad
-func JNI_OnLoad(jVM *C.JavaVM, reserved unsafe.Pointer) C.jint {
-	envPtr, freeFunc := util.GetEnv(jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-
-	util.Init(env)
-	ipc.Init(env)
-	security.Init(env)
-	return C.JNI_VERSION_1_6
-}
-
-func main() {
-	// Send all logging to stderr, so that the output is visible in Android.  Note that if this
-	// flag is removed, the process will likely crash as android requires that all logs are written
-	// into a specific directory.
-	flag.Set("logtostderr", "true")
-}
diff --git a/jni/runtimes/google/security/authorizer.go b/jni/runtimes/google/security/authorizer.go
deleted file mode 100644
index c21803f..0000000
--- a/jni/runtimes/google/security/authorizer.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// +build android
-
-package security
-
-import (
-	"runtime"
-	"unsafe"
-
-	"veyron/jni/runtimes/google/util"
-	"veyron2/security"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-// NewAuthorizer returns a new security.Authorizer given the provided Java authorizer.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func NewAuthorizer(jEnv, jAuthPtr interface{}) security.Authorizer {
-	env := (*C.JNIEnv)(unsafe.Pointer(util.PtrValue(jEnv)))
-	jAuth := C.jobject(unsafe.Pointer(util.PtrValue(jAuthPtr)))
-	// We cannot cache Java environments as they are only valid in the current
-	// thread.  We can, however, cache the Java VM and obtain an environment
-	// from it in whatever thread happens to be running at the time.
-	var jVM *C.JavaVM
-	if status := C.GetJavaVM(env, &jVM); status != 0 {
-		panic("couldn't get Java VM from the (Java) environment")
-	}
-	// Reference Java dispatcher; it will be de-referenced when the go
-	// dispatcher created below is garbage-collected (through the finalizer
-	// callback we setup below).
-	jAuth = C.NewGlobalRef(env, jAuth)
-	a := &authorizer{
-		jVM:   jVM,
-		jAuth: jAuth,
-	}
-	runtime.SetFinalizer(a, func(a *authorizer) {
-		envPtr, freeFunc := util.GetEnv(a.jVM)
-		env := (*C.JNIEnv)(envPtr)
-		defer freeFunc()
-		C.DeleteGlobalRef(env, a.jAuth)
-	})
-	return a
-}
-
-type authorizer struct {
-	jVM   *C.JavaVM
-	jAuth C.jobject
-}
-
-func (a *authorizer) Authorize(context security.Context) error {
-	envPtr, freeFunc := util.GetEnv(a.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	// Create a Java context.
-	jContext := newJavaContext(env, context)
-	// Run Java Authorizer.
-	contextSign := util.ClassSign("com.veyron2.security.Context")
-	return util.CallVoidMethod(env, a.jAuth, "authorize", []util.Sign{contextSign}, util.VoidSign, jContext)
-}
diff --git a/jni/runtimes/google/security/caveat.go b/jni/runtimes/google/security/caveat.go
deleted file mode 100644
index 55535c5..0000000
--- a/jni/runtimes/google/security/caveat.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// +build android
-
-package security
-
-import (
-	"runtime"
-
-	"veyron/jni/runtimes/google/util"
-	"veyron2/security"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-func newCaveat(env *C.JNIEnv, jCaveat C.jobject) *caveat {
-	// We cannot cache Java environments as they are only valid in the current
-	// thread.  We can, however, cache the Java VM and obtain an environment
-	// from it in whatever thread happens to be running at the time.
-	var jVM *C.JavaVM
-	if status := C.GetJavaVM(env, &jVM); status != 0 {
-		panic("couldn't get Java VM from the (Java) environment")
-	}
-	// Reference Java service caveat; it will be de-referenced when the go
-	// service caveat created below is garbage-collected (through the finalizer
-	// callback we setup just below).
-	jCaveat = C.NewGlobalRef(env, jCaveat)
-	c := &caveat{
-		jVM:     jVM,
-		jCaveat: jCaveat,
-	}
-	runtime.SetFinalizer(c, func(c *caveat) {
-		envPtr, freeFunc := util.GetEnv(c.jVM)
-		env := (*C.JNIEnv)(envPtr)
-		defer freeFunc()
-		C.DeleteGlobalRef(env, c.jCaveat)
-	})
-	return c
-}
-
-type caveat struct {
-	jVM     *C.JavaVM
-	jCaveat C.jobject
-}
-
-func (c *caveat) Validate(context security.Context) error {
-	envPtr, freeFunc := util.GetEnv(c.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	jContext := newJavaContext(env, context)
-	contextSign := util.ClassSign("com.veyron2.security.Context")
-	return util.CallVoidMethod(env, c.jCaveat, "validate", []util.Sign{contextSign}, jContext)
-}
diff --git a/jni/runtimes/google/security/context.go b/jni/runtimes/google/security/context.go
deleted file mode 100644
index 2d8bd11..0000000
--- a/jni/runtimes/google/security/context.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// +build android
-
-package security
-
-import (
-	"runtime"
-
-	"veyron/jni/runtimes/google/util"
-	inaming "veyron/runtimes/google/naming"
-	"veyron2/naming"
-	"veyron2/security"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-// newJavaContext constructs a new context in java based on the passed go context.
-func newJavaContext(env interface{}, context security.Context) C.jobject {
-	util.GoRef(&context) // Un-refed when the Java Context object is finalized.
-	return C.jobject(util.NewObjectOrCatch(env, jContextImplClass, []util.Sign{util.LongSign}, &context))
-}
-
-func newContext(env *C.JNIEnv, jContext C.jobject) *context {
-	// We cannot cache Java environments as they are only valid in the current
-	// thread.  We can, however, cache the Java VM and obtain an environment
-	// from it in whatever thread happens to be running at the time.
-	var jVM *C.JavaVM
-	if status := C.GetJavaVM(env, &jVM); status != 0 {
-		panic("couldn't get Java VM from the (Java) environment")
-	}
-	// Reference Java context; it will be de-referenced when the go context
-	// created below is garbage-collected (through the finalizer callback we
-	// setup just below).
-	jContext = C.NewGlobalRef(env, jContext)
-	c := &context{
-		jVM:      jVM,
-		jContext: jContext,
-	}
-	runtime.SetFinalizer(c, func(c *context) {
-		envPtr, freeFunc := util.GetEnv(c.jVM)
-		env := (*C.JNIEnv)(envPtr)
-		defer freeFunc()
-		C.DeleteGlobalRef(env, c.jContext)
-	})
-	return c
-}
-
-// context is the go interface to the java implementation of security.Context
-type context struct {
-	jVM      *C.JavaVM
-	jContext C.jobject
-}
-
-func (c *context) Method() string {
-	return c.callStringMethod("method")
-}
-
-func (c *context) Name() string {
-	return c.callStringMethod("name")
-}
-
-func (c *context) Suffix() string {
-	return c.callStringMethod("suffix")
-}
-
-func (c *context) Label() security.Label {
-	envPtr, freeFunc := util.GetEnv(c.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	labelSign := util.ClassSign("com.veyron2.security.Label")
-	jLabel := C.jobject(util.CallObjectMethodOrCatch(env, c.jContext, "label", nil, labelSign))
-	return security.Label(util.JIntField(env, jLabel, "value"))
-}
-
-func (c *context) CaveatDischarges() security.CaveatDischargeMap {
-	// TODO(spetrovic): implement this method.
-	return nil
-}
-
-func (c *context) LocalID() security.PublicID {
-	envPtr, freeFunc := util.GetEnv(c.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	publicIDSign := util.ClassSign("com.veyron2.security.PublicID")
-	jID := C.jobject(util.CallObjectMethodOrCatch(env, c.jContext, "localID", nil, publicIDSign))
-	idPtr := util.CallLongMethodOrCatch(env, jID, "getNativePtr", nil)
-	return (*(*security.PublicID)(util.Ptr(idPtr)))
-}
-
-func (c *context) RemoteID() security.PublicID {
-	envPtr, freeFunc := util.GetEnv(c.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	publicIDSign := util.ClassSign("com.veyron2.security.PublicID")
-	jID := C.jobject(util.CallObjectMethodOrCatch(env, c.jContext, "remoteID", nil, publicIDSign))
-	idPtr := util.CallLongMethodOrCatch(env, jID, "getNativePtr", nil)
-	return (*(*security.PublicID)(util.Ptr(idPtr)))
-}
-
-func (c *context) LocalEndpoint() naming.Endpoint {
-	envPtr, freeFunc := util.GetEnv(c.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	// TODO(spetrovic): create a Java Endpoint interface.
-	epStr := util.CallStringMethodOrCatch(env, c.jContext, "localEndpoint", nil)
-	ep, err := inaming.NewEndpoint(epStr)
-	if err != nil {
-		panic("Couldn't parse endpoint string: " + epStr)
-	}
-	return ep
-}
-
-func (c *context) RemoteEndpoint() naming.Endpoint {
-	envPtr, freeFunc := util.GetEnv(c.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	// TODO(spetrovic): create a Java Endpoint interface.
-	epStr := util.CallStringMethodOrCatch(env, c.jContext, "remoteEndpoint", nil)
-	ep, err := inaming.NewEndpoint(epStr)
-	if err != nil {
-		panic("Couldn't parse endpoint string: " + epStr)
-	}
-	return ep
-}
-
-func (c *context) callStringMethod(methodName string) string {
-	envPtr, freeFunc := util.GetEnv(c.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	return util.CallStringMethodOrCatch(env, c.jContext, methodName, nil)
-}
diff --git a/jni/runtimes/google/security/crypto_util.go b/jni/runtimes/google/security/crypto_util.go
deleted file mode 100644
index 6cc7174..0000000
--- a/jni/runtimes/google/security/crypto_util.go
+++ /dev/null
@@ -1,129 +0,0 @@
-package security
-
-import (
-	"crypto/ecdsa"
-	"crypto/elliptic"
-	"crypto/x509"
-	"crypto/x509/pkix"
-	"encoding/asn1"
-	"fmt"
-	"math/big"
-
-	"veyron2/security"
-)
-
-var (
-	oidPublicKeyECDSA = asn1.ObjectIdentifier{1, 2, 840, 10045, 2, 1}
-	oidNamedCurveP224 = asn1.ObjectIdentifier{1, 3, 132, 0, 33}
-	oidNamedCurveP256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7}
-	oidNamedCurveP384 = asn1.ObjectIdentifier{1, 3, 132, 0, 34}
-	oidNamedCurveP521 = asn1.ObjectIdentifier{1, 3, 132, 0, 35}
-)
-
-func oidFromNamedCurve(curve elliptic.Curve) (asn1.ObjectIdentifier, bool) {
-	switch curve {
-	case elliptic.P224():
-		return oidNamedCurveP224, true
-	case elliptic.P256():
-		return oidNamedCurveP256, true
-	case elliptic.P384():
-		return oidNamedCurveP384, true
-	case elliptic.P521():
-		return oidNamedCurveP521, true
-	}
-	return nil, false
-}
-
-// marshalPKCS8PrivateKey marshals the provided ECDSA private key into the
-// PKCS#8 private key format.
-func marshalPKCS8PrivateKey(key *ecdsa.PrivateKey) ([]byte, error) {
-	oid, ok := oidFromNamedCurve(key.PublicKey.Curve)
-	if !ok {
-		return nil, fmt.Errorf("illegal curve")
-	}
-	paramBytes, err := asn1.Marshal(oid)
-	if err != nil {
-		return nil, err
-	}
-	var algo pkix.AlgorithmIdentifier
-	algo.Algorithm = oidPublicKeyECDSA
-	algo.Parameters.FullBytes = paramBytes
-
-	privBytes, err := x509.MarshalECPrivateKey(key)
-	if err != nil {
-		return nil, err
-	}
-	pkcs8 := struct {
-		Version    int
-		Algo       pkix.AlgorithmIdentifier
-		PrivateKey []byte
-	}{
-		Version:    1,
-		Algo:       algo,
-		PrivateKey: privBytes,
-	}
-	return asn1.Marshal(pkcs8)
-}
-
-// parsePKCS8PrivateKey parses the provided private key in the PKCS#8 format.
-func parsePKCS8PrivateKey(data []byte) (*ecdsa.PrivateKey, error) {
-	key, err := x509.ParsePKCS8PrivateKey(data)
-	if err != nil {
-		return nil, err
-	}
-	eckey, ok := key.(*ecdsa.PrivateKey)
-	if !ok {
-		return nil, fmt.Errorf("not an ECDSA private key")
-	}
-	return eckey, nil
-}
-
-// marshalPKIXPublicKey marshals the provided ECDSA public key into the
-// DER-encoded PKIX format.
-func marshalPKIXPublicKey(key *ecdsa.PublicKey) ([]byte, error) {
-	return x509.MarshalPKIXPublicKey(key)
-}
-
-// parsePKIXPublicKey parses the provided DER encoded public key.
-func parsePKIXPublicKey(data []byte) (*ecdsa.PublicKey, error) {
-	key, err := x509.ParsePKIXPublicKey(data)
-	if err != nil {
-		return nil, err
-	}
-	eckey, ok := key.(*ecdsa.PublicKey)
-	if !ok {
-		return nil, fmt.Errorf("not an ECDSA public key")
-	}
-	return eckey, nil
-}
-
-// ecdsaSignature is a helper struct that is used to (de)serialize security.Signature.
-type ecdsaSignature struct {
-	// R, S specify the pair of integers that make up an ECDSA signature.
-	R, S *big.Int
-}
-
-// marshalECDSASignature returns the ASN.1 encoding of the provided ECDSA signature.
-func marshalECDSASignature(s security.Signature) ([]byte, error) {
-	sig := &ecdsaSignature{
-		R: new(big.Int).SetBytes(s.R),
-		S: new(big.Int).SetBytes(s.S),
-	}
-	return asn1.Marshal(sig)
-}
-
-// parseECDSASignature parses the ASN.1 encoded ECDSA signature.
-func parseECDSASignature(data []byte) (security.Signature, error) {
-	var sig ecdsaSignature
-	rest, err := asn1.Unmarshal(data, &sig)
-	if err != nil {
-		return security.Signature{}, err
-	}
-	if len(rest) > 0 {
-		return security.Signature{}, fmt.Errorf("shouldn't have remainder in ECDSA signature")
-	}
-	return security.Signature{
-		R: sig.R.Bytes(),
-		S: sig.S.Bytes(),
-	}, nil
-}
diff --git a/jni/runtimes/google/security/crypto_util_test.go b/jni/runtimes/google/security/crypto_util_test.go
deleted file mode 100644
index 1303c8d..0000000
--- a/jni/runtimes/google/security/crypto_util_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package security
-
-import (
-	"crypto/ecdsa"
-	"crypto/elliptic"
-	"crypto/rand"
-	"reflect"
-	"testing"
-)
-
-func TestCryptoUtilPublicKeyCoder(t *testing.T) {
-	priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
-	if err != nil {
-		t.Fatalf("couldn't generate private key: %v", err)
-	}
-	pub := &priv.PublicKey
-	data, err := marshalPKIXPublicKey(pub)
-	if err != nil {
-		t.Fatalf("couldn't marshal public key: %v", err)
-	}
-	pubNew, err := parsePKIXPublicKey(data)
-	if err != nil {
-		t.Fatalf("couldn't parse public key: %v", err)
-	}
-	if !reflect.DeepEqual(pub, pubNew) {
-		t.Fatalf("public keys don't match")
-	}
-}
-
-func TestCryptoUtilPrivateKeyCoder(t *testing.T) {
-	priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
-	if err != nil {
-		t.Fatalf("couldn't generate private key: %v", err)
-	}
-	data, err := marshalPKCS8PrivateKey(priv)
-	if err != nil {
-		t.Fatalf("couldn't marshal private key: %v", err)
-	}
-	privNew, err := parsePKCS8PrivateKey(data)
-	if err != nil {
-		t.Fatalf("couldn't parse private key: %v", err)
-	}
-	if !reflect.DeepEqual(priv, privNew) {
-		t.Fatalf("private keys don't match")
-	}
-}
diff --git a/jni/runtimes/google/security/jni.go b/jni/runtimes/google/security/jni.go
deleted file mode 100644
index 0852ec0..0000000
--- a/jni/runtimes/google/security/jni.go
+++ /dev/null
@@ -1,290 +0,0 @@
-// +build android
-
-package security
-
-import (
-	"reflect"
-	"time"
-	"unsafe"
-
-	"veyron/jni/runtimes/google/util"
-	isecurity "veyron/runtimes/google/security"
-	"veyron2/security"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-var (
-	// Global reference for com.veyron.runtimes.google.security.PublicID class.
-	jPublicIDImplClass C.jclass
-	// Global reference for com.veyron.runtimes.google.security.Caveat class.
-	jCaveatImplClass C.jclass
-	// Global reference for com.veyron.runtimes.google.security.Context class.
-	jContextImplClass C.jclass
-	// Global reference for com.veyron2.security.Caveat class.
-	jCaveatClass C.jclass
-	// Global reference for com.veyron2.security.ServiceCaveat class.
-	jServiceCaveatClass C.jclass
-	// Global reference for com.veyron2.security.BlessingPattern class.
-	jBlessingPatternClass C.jclass
-	// Global reference for org.joda.time.Duration class.
-	jDurationClass C.jclass
-
-	// Signature of the PublicID interface.
-	publicIDSign = util.ClassSign("com.veyron2.security.PublicID")
-	// Signature of the BlessingPattern class.
-	principalPatternSign = util.ClassSign("com.veyron2.security.BlessingPattern")
-)
-
-// Init initializes the JNI code with the given Java evironment. This method
-// must be called from the main Java thread.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java environment is passed in an empty
-// interface and then cast into the package-local environment type.
-func Init(jEnv interface{}) {
-	env := (*C.JNIEnv)(unsafe.Pointer(util.PtrValue(jEnv)))
-	// Cache global references to all Java classes used by the package.  This is
-	// necessary because JNI gets access to the class loader only in the system
-	// thread, so we aren't able to invoke FindClass in other threads.
-	jPublicIDImplClass = C.jclass(util.JFindClassPtrOrDie(env, "com/veyron/runtimes/google/security/PublicID"))
-	jCaveatImplClass = C.jclass(util.JFindClassPtrOrDie(env, "com/veyron/runtimes/google/security/Caveat"))
-	jContextImplClass = C.jclass(util.JFindClassPtrOrDie(env, "com/veyron/runtimes/google/security/Context"))
-	jCaveatClass = C.jclass(util.JFindClassPtrOrDie(env, "com/veyron2/security/Caveat"))
-	jServiceCaveatClass = C.jclass(util.JFindClassPtrOrDie(env, "com/veyron2/security/ServiceCaveat"))
-	jBlessingPatternClass = C.jclass(util.JFindClassPtrOrDie(env, "com/veyron2/security/BlessingPattern"))
-	jDurationClass = C.jclass(util.JFindClassPtrOrDie(env, "org/joda/time/Duration"))
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicIDStore_nativeCreate
-func Java_com_veyron_runtimes_google_security_PublicIDStore_nativeCreate(env *C.JNIEnv, jPublicIDStoreClass C.jclass, jParams C.jobject) C.jlong {
-	var params *isecurity.PublicIDStoreParams
-	if jParams != nil {
-		dir := util.JStringField(env, jParams, "dir")
-		jSigner := C.jobject(util.JObjectFieldPtr(env, jParams, "signer"))
-		signer := newSigner(env, jSigner)
-		params = &isecurity.PublicIDStoreParams{
-			Dir:    dir,
-			Signer: signer,
-		}
-	}
-	store, err := isecurity.NewPublicIDStore(params)
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jlong(0)
-	}
-	util.GoRef(&store) // Un-refed when the Java PublicIDStore is finalized.
-	return C.jlong(util.PtrValue(&store))
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicIDStore_nativeAdd
-func Java_com_veyron_runtimes_google_security_PublicIDStore_nativeAdd(env *C.JNIEnv, jPublicIDStore C.jobject, goPublicIDStorePtr C.jlong, jID C.jobject, jPeerPattern C.jstring) {
-	idPtr := util.CallLongMethodOrCatch(env, jID, "getNativePtr", nil)
-	id := (*(*security.PublicID)(util.Ptr(idPtr)))
-	peerPattern := security.BlessingPattern(util.GoString(env, jPeerPattern))
-	if err := (*(*security.PublicIDStore)(util.Ptr(goPublicIDStorePtr))).Add(id, peerPattern); err != nil {
-		util.JThrowV(env, err)
-		return
-	}
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicIDStore_nativeGetPeerID
-func Java_com_veyron_runtimes_google_security_PublicIDStore_nativeGetPeerID(env *C.JNIEnv, jPublicIDStore C.jobject, goPublicIDStorePtr C.jlong, jPeerID C.jobject) C.jlong {
-	peerIDPtr := util.CallLongMethodOrCatch(env, jPeerID, "getNativePtr", nil)
-	peerID := (*(*security.PublicID)(util.Ptr(peerIDPtr)))
-	id, err := (*(*security.PublicIDStore)(util.Ptr(goPublicIDStorePtr))).ForPeer(peerID)
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jlong(0)
-	}
-	util.GoRef(&id) // Un-refed when the Java PublicID is finalized.
-	return C.jlong(util.PtrValue(&id))
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicIDStore_nativeDefaultPublicID
-func Java_com_veyron_runtimes_google_security_PublicIDStore_nativeDefaultPublicID(env *C.JNIEnv, jPublicIDStore C.jobject, goPublicIDStorePtr C.jlong) C.jlong {
-	id, err := (*(*security.PublicIDStore)(util.Ptr(goPublicIDStorePtr))).DefaultPublicID()
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jlong(0)
-	}
-	util.GoRef(&id) // Un-refed when the Java PublicID is finalized.
-	return C.jlong(util.PtrValue(&id))
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicIDStore_nativeSetDefaultBlessingPattern
-func Java_com_veyron_runtimes_google_security_PublicIDStore_nativeSetDefaultBlessingPattern(env *C.JNIEnv, jPublicIDStore C.jobject, goPublicIDStorePtr C.jlong, jPattern C.jstring) {
-	pattern := security.BlessingPattern(util.GoString(env, jPattern))
-	if err := (*(*security.PublicIDStore)(util.Ptr(goPublicIDStorePtr))).SetDefaultBlessingPattern(pattern); err != nil {
-		util.JThrowV(env, err)
-		return
-	}
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicIDStore_nativeFinalize
-func Java_com_veyron_runtimes_google_security_PublicIDStore_nativeFinalize(env *C.JNIEnv, jPublicIDStore C.jobject, goPublicIDStorePtr C.jlong) {
-	util.GoUnref((*security.PublicIDStore)(util.Ptr(goPublicIDStorePtr)))
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicID_nativeNames
-func Java_com_veyron_runtimes_google_security_PublicID_nativeNames(env *C.JNIEnv, jPublicID C.jobject, goPublicIDPtr C.jlong) C.jobjectArray {
-	names := (*(*security.PublicID)(util.Ptr(goPublicIDPtr))).Names()
-	return C.jobjectArray(util.JStringArrayPtr(env, names))
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicID_nativePublicKey
-func Java_com_veyron_runtimes_google_security_PublicID_nativePublicKey(env *C.JNIEnv, jPublicID C.jobject, goPublicIDPtr C.jlong) C.jbyteArray {
-	key := (*(*security.PublicID)(util.Ptr(goPublicIDPtr))).PublicKey()
-	encoded, err := marshalPKIXPublicKey(key)
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jbyteArray(nil)
-	}
-	return C.jbyteArray(util.JByteArrayPtr(env, encoded))
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicID_nativeAuthorize
-func Java_com_veyron_runtimes_google_security_PublicID_nativeAuthorize(env *C.JNIEnv, jPublicID C.jobject, goPublicIDPtr C.jlong, jContext C.jobject) C.jlong {
-	id, err := (*(*security.PublicID)(util.Ptr(goPublicIDPtr))).Authorize(newContext(env, jContext))
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jlong(0)
-	}
-	util.GoRef(&id) // Un-refed when the Java PublicID is finalized.
-	return C.jlong(util.PtrValue(&id))
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicID_nativeThirdPartyCaveats
-func Java_com_veyron_runtimes_google_security_PublicID_nativeThirdPartyCaveats(env *C.JNIEnv, jPublicID C.jobject, goPublicIDPtr C.jlong) C.jobjectArray {
-	sCaveats := (*(*security.PublicID)(util.Ptr(goPublicIDPtr))).ThirdPartyCaveats()
-	return newJavaServiceCaveatArray(env, sCaveats)
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicID_nativeEquals
-func Java_com_veyron_runtimes_google_security_PublicID_nativeEquals(env *C.JNIEnv, jPublicID C.jobject, goPublicIDPtr, goOtherPublicIDPtr C.jlong) C.jboolean {
-	id := *(*security.PublicID)(util.Ptr(goPublicIDPtr))
-	other := *(*security.PublicID)(util.Ptr(goOtherPublicIDPtr))
-	if reflect.DeepEqual(id, other) {
-		return C.JNI_TRUE
-	}
-	return C.JNI_FALSE
-}
-
-//export Java_com_veyron_runtimes_google_security_PublicID_nativeFinalize
-func Java_com_veyron_runtimes_google_security_PublicID_nativeFinalize(env *C.JNIEnv, jPublicID C.jobject, goPublicIDPtr C.jlong) {
-	util.GoUnref((*security.PublicID)(util.Ptr(goPublicIDPtr)))
-}
-
-//export Java_com_veyron_runtimes_google_security_PrivateID_nativeCreate
-func Java_com_veyron_runtimes_google_security_PrivateID_nativeCreate(env *C.JNIEnv, jPrivateIDClass C.jclass, name C.jstring, jSigner C.jobject) C.jlong {
-	signer := newSigner(env, jSigner)
-	id, err := isecurity.NewPrivateID(util.GoString(env, name), signer)
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jlong(0)
-	}
-	util.GoRef(&id) // Un-refed when the Java PrivateID is finalized.
-	return C.jlong(util.PtrValue(&id))
-}
-
-//export Java_com_veyron_runtimes_google_security_PrivateID_nativePublicID
-func Java_com_veyron_runtimes_google_security_PrivateID_nativePublicID(env *C.JNIEnv, jPrivateID C.jobject, goPrivateIDPtr C.jlong) C.jlong {
-	id := (*(*security.PrivateID)(util.Ptr(goPrivateIDPtr))).PublicID()
-	util.GoRef(&id) // Un-refed when the Java PublicID is finalized.
-	return C.jlong(util.PtrValue(&id))
-}
-
-//export Java_com_veyron_runtimes_google_security_PrivateID_nativeBless
-func Java_com_veyron_runtimes_google_security_PrivateID_nativeBless(env *C.JNIEnv, jPrivateID C.jobject, goPrivateIDPtr C.jlong, jBlessee C.jobject, name C.jstring, jDuration C.jobject, jServiceCaveats C.jobjectArray) C.jlong {
-	blesseePtr := util.CallLongMethodOrCatch(env, jBlessee, "getNativePtr", nil)
-	blessee := (*(*security.PublicID)(util.Ptr(blesseePtr)))
-	duration := time.Duration(util.CallLongMethodOrCatch(env, jDuration, "getMillis", nil)) * time.Millisecond
-	sCaveats := newServiceCaveatArray(env, jServiceCaveats)
-	id, err := (*(*security.PrivateID)(util.Ptr(goPrivateIDPtr))).Bless(blessee, util.GoString(env, name), duration, sCaveats)
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jlong(0)
-	}
-	util.GoRef(&id) // Un-refed when the Java PublicID is finalized
-	return C.jlong(util.PtrValue(&id))
-}
-
-//export Java_com_veyron_runtimes_google_security_PrivateID_nativeDerive
-func Java_com_veyron_runtimes_google_security_PrivateID_nativeDerive(env *C.JNIEnv, jPrivateID C.jobject, goPrivateIDPtr C.jlong, jPublicID C.jobject) C.jlong {
-	publicIDPtr := util.CallLongMethodOrCatch(env, jPublicID, "getNativePtr", nil)
-	publicID := (*(*security.PublicID)(util.Ptr(publicIDPtr)))
-	id, err := (*(*security.PrivateID)(util.Ptr(goPrivateIDPtr))).Derive(publicID)
-	if err != nil {
-		util.JThrowV(env, err)
-		return C.jlong(0)
-	}
-	util.GoRef(&id) // Un-refed when the Java PrivateID is finalized.
-	return C.jlong(util.PtrValue(&id))
-}
-
-//export Java_com_veyron_runtimes_google_security_PrivateID_nativeFinalize
-func Java_com_veyron_runtimes_google_security_PrivateID_nativeFinalize(env *C.JNIEnv, jPrivateID C.jobject, goPrivateIDPtr C.jlong) {
-	util.GoUnref((*security.PrivateID)(util.Ptr(goPrivateIDPtr)))
-}
-
-//export Java_com_veyron_runtimes_google_security_Context_nativeMethod
-func Java_com_veyron_runtimes_google_security_Context_nativeMethod(env *C.JNIEnv, jContext C.jobject, goContextPtr C.jlong) C.jstring {
-	return C.jstring(util.JStringPtr(env, (*(*security.Context)(util.Ptr(goContextPtr))).Method()))
-}
-
-//export Java_com_veyron_runtimes_google_security_Context_nativeName
-func Java_com_veyron_runtimes_google_security_Context_nativeName(env *C.JNIEnv, jServerCall C.jobject, goContextPtr C.jlong) C.jstring {
-	return C.jstring(util.JStringPtr(env, (*(*security.Context)(util.Ptr(goContextPtr))).Name()))
-}
-
-//export Java_com_veyron_runtimes_google_security_Context_nativeSuffix
-func Java_com_veyron_runtimes_google_security_Context_nativeSuffix(env *C.JNIEnv, jServerCall C.jobject, goContextPtr C.jlong) C.jstring {
-	return C.jstring(util.JStringPtr(env, (*(*security.Context)(util.Ptr(goContextPtr))).Suffix()))
-}
-
-//export Java_com_veyron_runtimes_google_security_Context_nativeLabel
-func Java_com_veyron_runtimes_google_security_Context_nativeLabel(env *C.JNIEnv, jServerCall C.jobject, goContextPtr C.jlong) C.jint {
-	return C.jint((*(*security.Context)(util.Ptr(goContextPtr))).Label())
-}
-
-//export Java_com_veyron_runtimes_google_security_Context_nativeLocalID
-func Java_com_veyron_runtimes_google_security_Context_nativeLocalID(env *C.JNIEnv, jServerCall C.jobject, goContextPtr C.jlong) C.jlong {
-	id := (*(*security.Context)(util.Ptr(goContextPtr))).LocalID()
-	util.GoRef(&id) // Un-refed when the Java PublicID object is finalized.
-	return C.jlong(util.PtrValue(&id))
-}
-
-//export Java_com_veyron_runtimes_google_security_Context_nativeRemoteID
-func Java_com_veyron_runtimes_google_security_Context_nativeRemoteID(env *C.JNIEnv, jServerCall C.jobject, goContextPtr C.jlong) C.jlong {
-	id := (*(*security.Context)(util.Ptr(goContextPtr))).RemoteID()
-	util.GoRef(&id)
-	return C.jlong(util.PtrValue(&id))
-}
-
-//export Java_com_veyron_runtimes_google_security_Context_nativeLocalEndpoint
-func Java_com_veyron_runtimes_google_security_Context_nativeLocalEndpoint(env *C.JNIEnv, jServerCall C.jobject, goContextPtr C.jlong) C.jstring {
-	return C.jstring(util.JStringPtr(env, (*(*security.Context)(util.Ptr(goContextPtr))).LocalEndpoint().String()))
-}
-
-//export Java_com_veyron_runtimes_google_security_Context_nativeRemoteEndpoint
-func Java_com_veyron_runtimes_google_security_Context_nativeRemoteEndpoint(env *C.JNIEnv, jServerCall C.jobject, goContextPtr C.jlong) C.jstring {
-	return C.jstring(util.JStringPtr(env, (*(*security.Context)(util.Ptr(goContextPtr))).RemoteEndpoint().String()))
-}
-
-//export Java_com_veyron_runtimes_google_security_Context_nativeFinalize
-func Java_com_veyron_runtimes_google_security_Context_nativeFinalize(env *C.JNIEnv, jServerCall C.jobject, goContextPtr C.jlong) {
-	util.GoUnref((*security.Context)(util.Ptr(goContextPtr)))
-}
-
-//export Java_com_veyron_runtimes_google_security_Caveat_nativeValidate
-func Java_com_veyron_runtimes_google_security_Caveat_nativeValidate(env *C.JNIEnv, jServerCall C.jobject, goCaveatPtr C.jlong, jContext C.jobject) {
-	if err := (*(*security.Caveat)(util.Ptr(goCaveatPtr))).Validate(newContext(env, jContext)); err != nil {
-		util.JThrowV(env, err)
-	}
-}
-
-//export Java_com_veyron_runtimes_google_security_Caveat_nativeFinalize
-func Java_com_veyron_runtimes_google_security_Caveat_nativeFinalize(env *C.JNIEnv, jServerCall C.jobject, goCaveatPtr C.jlong) {
-	util.GoUnref((*security.Caveat)(util.Ptr(goCaveatPtr)))
-}
diff --git a/jni/runtimes/google/security/privateid.go b/jni/runtimes/google/security/privateid.go
deleted file mode 100644
index c4d10e2..0000000
--- a/jni/runtimes/google/security/privateid.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// +build android
-
-package security
-
-import (
-	"fmt"
-	"runtime"
-	"time"
-	"unsafe"
-
-	"veyron/jni/runtimes/google/util"
-	"veyron2/security"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-// NewPrivateID creates an instance of security.PrivateID that uses the provided
-// Java PrivateID as its underlying implementation.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func NewPrivateID(jEnv, jPrivID interface{}) security.PrivateID {
-	env := (*C.JNIEnv)(unsafe.Pointer(util.PtrValue(jEnv)))
-	jPrivateID := C.jobject(unsafe.Pointer(util.PtrValue(jPrivID)))
-
-	// We cannot cache Java environments as they are only valid in the current
-	// thread.  We can, however, cache the Java VM and obtain an environment
-	// from it in whatever thread happens to be running at the time.
-	var jVM *C.JavaVM
-	if status := C.GetJavaVM(env, &jVM); status != 0 {
-		panic("couldn't get Java VM from the (Java) environment")
-	}
-	// Create Go Signer.
-	signer := newSigner(env, jPrivateID)
-	// Reference Java PrivateID; it will be de-referenced when the Go PrivateID
-	// created below is garbage-collected (through the finalizer callback we
-	// setup just below).
-	jPrivateID = C.NewGlobalRef(env, jPrivateID)
-	// Create Go PrivateID.
-	id := &privateID{
-		Signer:     signer,
-		jVM:        jVM,
-		jPrivateID: jPrivateID,
-	}
-	runtime.SetFinalizer(id, func(id *privateID) {
-		envPtr, freeFunc := util.GetEnv(id.jVM)
-		env := (*C.JNIEnv)(envPtr)
-		defer freeFunc()
-		C.DeleteGlobalRef(env, id.jPrivateID)
-	})
-	return id
-}
-
-type privateID struct {
-	security.Signer
-	jVM        *C.JavaVM
-	jPrivateID C.jobject
-}
-
-func (id *privateID) PublicID() security.PublicID {
-	envPtr, freeFunc := util.GetEnv(id.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	jPublicID := C.jobject(util.CallObjectMethodOrCatch(env, id.jPrivateID, "publicID", nil, publicIDSign))
-	publicIDPtr := util.CallLongMethodOrCatch(env, jPublicID, "getNativePtr", nil)
-	return (*(*security.PublicID)(util.Ptr(publicIDPtr)))
-}
-
-func (id *privateID) Bless(blessee security.PublicID, blessingName string, duration time.Duration, caveats []security.ServiceCaveat) (security.PublicID, error) {
-	envPtr, freeFunc := util.GetEnv(id.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	util.GoRef(&blessee) // Un-refed when the Java blessee object created below is finalized.
-	jBlessee := C.jobject(util.NewObjectOrCatch(env, jPublicIDImplClass, []util.Sign{util.LongSign}, &blessee))
-	jDuration := C.jobject(util.NewObjectOrCatch(env, jDurationClass, []util.Sign{util.LongSign}, int64(duration.Seconds()*1000)))
-	jServiceCaveats := newJavaServiceCaveatArray(env, caveats)
-	sCaveatSign := util.ClassSign("com.veyron2.security.ServiceCaveat")
-	durationSign := util.ClassSign("org.joda.time.Duration")
-	jPublicID, err := util.CallObjectMethod(env, id.jPrivateID, "bless", []util.Sign{publicIDSign, util.StringSign, durationSign, util.ArraySign(sCaveatSign)}, publicIDSign, jBlessee, blessingName, jDuration, jServiceCaveats)
-	if err != nil {
-		return nil, err
-	}
-	publicIDPtr := util.CallLongMethodOrCatch(env, jPublicID, "getNativePtr", nil)
-	return (*(*security.PublicID)(util.Ptr(publicIDPtr))), nil
-}
-
-func (id *privateID) Derive(publicID security.PublicID) (security.PrivateID, error) {
-	envPtr, freeFunc := util.GetEnv(id.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	util.GoRef(&publicID) // Un-refed when the Java PublicID object created below is finalized.
-	jPublicID := C.jobject(util.NewObjectOrCatch(env, jPublicIDImplClass, []util.Sign{util.LongSign}, &publicID))
-	privateIDSign := util.ClassSign("com.veyron2.security.PublicID")
-	jPrivateID, err := util.CallObjectMethod(env, id.jPrivateID, "derive", []util.Sign{publicIDSign}, privateIDSign, jPublicID)
-	if err != nil {
-		return nil, err
-	}
-	return NewPrivateID(env, C.jobject(jPrivateID)), nil
-}
-
-func (id *privateID) MintDischarge(caveat security.ThirdPartyCaveat, context security.Context, duration time.Duration, caveats []security.ServiceCaveat) (security.ThirdPartyDischarge, error) {
-	return nil, fmt.Errorf("MintDischarge currently not implemented.")
-}
diff --git a/jni/runtimes/google/security/publicid.go b/jni/runtimes/google/security/publicid.go
deleted file mode 100644
index 9ef816b..0000000
--- a/jni/runtimes/google/security/publicid.go
+++ /dev/null
@@ -1,97 +0,0 @@
-// +build android
-
-package security
-
-import (
-	"crypto/ecdsa"
-	"runtime"
-
-	"veyron/jni/runtimes/google/util"
-	"veyron2/security"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-func newPublicID(env *C.JNIEnv, jPublicID C.jobject) *publicID {
-	// We cannot cache Java environments as they are only valid in the current
-	// thread.  We can, however, cache the Java VM and obtain an environment
-	// from it in whatever thread happens to be running at the time.
-	var jVM *C.JavaVM
-	if status := C.GetJavaVM(env, &jVM); status != 0 {
-		panic("couldn't get Java VM from the (Java) environment")
-	}
-	// Reference Java public id; it will be de-referenced when the go public id
-	// created below is garbage-collected (through the finalizer callback we
-	// setup just below).
-	jPublicID = C.NewGlobalRef(env, jPublicID)
-	id := &publicID{
-		jVM:       jVM,
-		jPublicID: jPublicID,
-	}
-	runtime.SetFinalizer(id, func(id *publicID) {
-		var env *C.JNIEnv
-		C.AttachCurrentThread(id.jVM, &env, nil)
-		defer C.DetachCurrentThread(id.jVM)
-		C.DeleteGlobalRef(env, id.jPublicID)
-	})
-	return id
-}
-
-type publicID struct {
-	jVM       *C.JavaVM
-	jPublicID C.jobject
-}
-
-func (id *publicID) Names() []string {
-	envPtr, freeFunc := util.GetEnv(id.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	return util.CallStringArrayMethodOrCatch(env, id.jPublicID, "names", nil)
-}
-
-func (id *publicID) PublicKey() *ecdsa.PublicKey {
-	envPtr, freeFunc := util.GetEnv(id.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	publicKeySign := util.ClassSign("java.security.interfaces.ECPublicKey")
-	jPublicKey := C.jobject(util.CallObjectMethodOrCatch(env, id.jPublicID, "publicKey", nil, publicKeySign))
-	// Get the encoded version of the public key.
-	encoded := util.CallByteArrayMethodOrCatch(env, jPublicKey, "getEncoded", nil)
-	key, err := parsePKIXPublicKey(encoded)
-	if err != nil {
-		panic("couldn't parse Java ECDSA public key: " + err.Error())
-	}
-	return key
-}
-
-func (id *publicID) Authorize(context security.Context) (security.PublicID, error) {
-	envPtr, freeFunc := util.GetEnv(id.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	jContext := newJavaContext(env, context)
-	contextSign := util.ClassSign("com.veyron2.security.Context")
-	publicIDSign := util.ClassSign("com.veyron2.security.PublicID")
-	jPublicID, err := util.CallObjectMethod(env, id.jPublicID, "authorize", []util.Sign{contextSign}, publicIDSign, jContext)
-	if err != nil {
-		return nil, err
-	}
-	return newPublicID(env, C.jobject(jPublicID)), nil
-}
-
-func (id *publicID) ThirdPartyCaveats() []security.ServiceCaveat {
-	envPtr, freeFunc := util.GetEnv(id.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	serviceCaveatSign := util.ClassSign("com.veyron2.security.ServiceCaveat")
-	jServiceCaveats := util.CallObjectArrayMethodOrCatch(env, id.jPublicID, "thirdPartyCaveats", nil, util.ArraySign(serviceCaveatSign))
-	sCaveats := make([]security.ServiceCaveat, len(jServiceCaveats))
-	for i, jcaveat := range jServiceCaveats {
-		sCaveats[i] = security.ServiceCaveat{
-			Service: security.BlessingPattern(util.JStringField(env, C.jobject(jcaveat), "service")),
-			Caveat:  newCaveat(env, C.jobject(jcaveat)),
-		}
-	}
-	return sCaveats
-}
diff --git a/jni/runtimes/google/security/publicid_store.go b/jni/runtimes/google/security/publicid_store.go
deleted file mode 100644
index 04334f5..0000000
--- a/jni/runtimes/google/security/publicid_store.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// +build android
-
-package security
-
-import (
-	"runtime"
-	"unsafe"
-
-	"veyron/jni/runtimes/google/util"
-	"veyron2/security"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-// NewPublicIDStore creates an instance of security.PublicIDStore that uses the
-// provided Java PublicIDStore as its underlying implementation.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func NewPublicIDStore(jEnv, jStore interface{}) security.PublicIDStore {
-	env := (*C.JNIEnv)(unsafe.Pointer(util.PtrValue(jEnv)))
-	jPublicIDStore := C.jobject(unsafe.Pointer(util.PtrValue(jStore)))
-
-	// We cannot cache Java environments as they are only valid in the current
-	// thread.  We can, however, cache the Java VM and obtain an environment
-	// from it in whatever thread happens to be running at the time.
-	var jVM *C.JavaVM
-	if status := C.GetJavaVM(env, &jVM); status != 0 {
-		panic("couldn't get Java VM from the (Java) environment")
-	}
-
-	// Reference Java PublicIDStore; it will be de-referenced when the Go
-	// PublicIDStore created below is garbage-collected (through the finalizer
-	// callback we setup just below).
-	jPublicIDStore = C.NewGlobalRef(env, jPublicIDStore)
-	// Create Go PublicIDStore.
-	s := &publicIDStore{
-		jVM:            jVM,
-		jPublicIDStore: jPublicIDStore,
-	}
-	runtime.SetFinalizer(s, func(s *publicIDStore) {
-		envPtr, freeFunc := util.GetEnv(s.jVM)
-		env := (*C.JNIEnv)(envPtr)
-		defer freeFunc()
-		C.DeleteGlobalRef(env, s.jPublicIDStore)
-	})
-	return s
-}
-
-type publicIDStore struct {
-	jVM            *C.JavaVM
-	jPublicIDStore C.jobject
-}
-
-func (s *publicIDStore) Add(id security.PublicID, peerPattern security.BlessingPattern) error {
-	envPtr, freeFunc := util.GetEnv(s.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	util.GoRef(&id) // Un-refed when the Java PublicID object created below is finalized.
-	jPublicID := C.jobject(util.NewObjectOrCatch(env, jPublicIDImplClass, []util.Sign{util.LongSign}, &id))
-	jBlessingPattern := C.jobject(util.NewObjectOrCatch(env, jBlessingPatternClass, []util.Sign{util.StringSign}, string(peerPattern)))
-	return util.CallVoidMethod(env, s.jPublicIDStore, "add", []util.Sign{publicIDSign, principalPatternSign}, jPublicID, jBlessingPattern)
-}
-
-func (s *publicIDStore) ForPeer(peer security.PublicID) (security.PublicID, error) {
-	envPtr, freeFunc := util.GetEnv(s.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	util.GoRef(&peer) // Un-refed when the Java peer object created below is finalized.
-	jPeer := C.jobject(util.NewObjectOrCatch(env, jPublicIDImplClass, []util.Sign{util.LongSign}, &peer))
-	jPublicID, err := util.CallObjectMethod(env, s.jPublicIDStore, "forPeer", []util.Sign{publicIDSign}, publicIDSign, jPeer)
-	if err != nil {
-		return nil, err
-	}
-	publicIDPtr := util.CallLongMethodOrCatch(env, jPublicID, "getNativePtr", nil)
-	return (*(*security.PublicID)(util.Ptr(publicIDPtr))), nil
-}
-
-func (s *publicIDStore) DefaultPublicID() (security.PublicID, error) {
-	envPtr, freeFunc := util.GetEnv(s.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	jPublicID, err := util.CallObjectMethod(env, s.jPublicIDStore, "defaultPublicID", []util.Sign{}, publicIDSign)
-	if err != nil {
-		return nil, err
-	}
-	publicIDPtr := util.CallLongMethodOrCatch(env, jPublicID, "getNativePtr", nil)
-	return (*(*security.PublicID)(util.Ptr(publicIDPtr))), nil
-}
-
-func (s *publicIDStore) SetDefaultBlessingPattern(pattern security.BlessingPattern) error {
-	envPtr, freeFunc := util.GetEnv(s.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	jPattern := C.jobject(util.NewObjectOrCatch(env, jBlessingPatternClass, []util.Sign{util.StringSign}, string(pattern)))
-	return util.CallVoidMethod(env, s.jPublicIDStore, "setDefaultBlessingPattern", []util.Sign{principalPatternSign}, jPattern)
-}
diff --git a/jni/runtimes/google/security/service_caveat.go b/jni/runtimes/google/security/service_caveat.go
deleted file mode 100644
index a6e599c..0000000
--- a/jni/runtimes/google/security/service_caveat.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// +build android
-
-package security
-
-import (
-	"veyron/jni/runtimes/google/util"
-	"veyron2/security"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-// newServiceCaveatArray converts a Java ServiceCaveat array into a Go ServiceCaveat array.
-func newServiceCaveatArray(env *C.JNIEnv, jServiceCaveats C.jobjectArray) []security.ServiceCaveat {
-	length := int(C.GetArrayLength(env, C.jarray(jServiceCaveats)))
-	sCaveats := make([]security.ServiceCaveat, length)
-	for i := 0; i < length; i++ {
-		jServiceCaveat := C.GetObjectArrayElement(env, jServiceCaveats, C.jsize(i))
-		jBlessingPattern := C.jobject(util.CallObjectMethodOrCatch(env, jServiceCaveat, "getServices", nil, util.ClassSign("com.veyron2.security.BlessingPattern")))
-		services := util.CallStringMethodOrCatch(env, jBlessingPattern, "getValue", nil)
-		jCaveat := C.jobject(util.CallObjectMethodOrCatch(env, jServiceCaveat, "getCaveat", nil, util.ClassSign("com.veyron2.security.Caveat")))
-		// TODO(spetrovic): we get native pointer for PublicID and it works because the plan is for
-		// PublicID to be an interface with only a few implementations in veyron2: folks aren't
-		// supposed to create their own PublicID implementations.  Caveat is different in that
-		// people are supposed to create their own Caveat implementation and the servers are
-		// supposed to be able to understand these custom Caveats.  So we really won't have
-		// access to native caveats here, which means we have to provide a way to Vom-Encode/Decode
-		// them from Java and then un-serialize them into a Java object.
-		caveatPtr := util.CallLongMethodOrCatch(env, jCaveat, "getNativePtr", nil)
-		caveat := (*(*security.Caveat)(util.Ptr(caveatPtr)))
-		sCaveats[i] = security.ServiceCaveat{
-			Service: security.BlessingPattern(services),
-			Caveat:  caveat,
-		}
-	}
-	return sCaveats
-}
-
-// newJavaServiceCaveatArray converts a Go ServiceCaveat array into a Java ServiceCaveat array.
-func newJavaServiceCaveatArray(env *C.JNIEnv, sCaveats []security.ServiceCaveat) C.jobjectArray {
-	jServiceCaveats := C.NewObjectArray(env, C.jsize(len(sCaveats)), jServiceCaveatClass, nil)
-	for i, sCaveat := range sCaveats {
-		caveat := sCaveat.Caveat
-		util.GoRef(&caveat) // Un-refed when the Java Caveat object is finalized.
-		jCaveat := C.jobject(util.NewObjectOrCatch(env, jCaveatImplClass, []util.Sign{util.LongSign}, &caveat))
-		services := string(sCaveat.Service)
-		jPattern := C.jobject(util.NewObjectOrCatch(env, jBlessingPatternClass, []util.Sign{util.StringSign}, services))
-		patternSign := util.ClassSign("com.veyron2.security.BlessingPattern")
-		caveatSign := util.ClassSign("com.veyron2.security.Caveat")
-		jServiceCaveat := C.jobject(util.NewObjectOrCatch(env, jServiceCaveatClass, []util.Sign{patternSign, caveatSign}, jPattern, jCaveat))
-		C.SetObjectArrayElement(env, jServiceCaveats, C.jsize(i), jServiceCaveat)
-	}
-	return jServiceCaveats
-}
diff --git a/jni/runtimes/google/security/signer.go b/jni/runtimes/google/security/signer.go
deleted file mode 100644
index 7543d01..0000000
--- a/jni/runtimes/google/security/signer.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// +build android
-
-package security
-
-import (
-	"crypto/ecdsa"
-	"runtime"
-
-	"veyron/jni/runtimes/google/util"
-	"veyron2/security"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include "jni_wrapper.h"
-import "C"
-
-// newSigner creates an instance of security.Signer that uses the provided
-// Java Signer as its underlying implementation.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func newSigner(env *C.JNIEnv, jSigner C.jobject) security.Signer {
-	// We cannot cache Java environments as they are only valid in the current
-	// thread.  We can, however, cache the Java VM and obtain an environment
-	// from it in whatever thread happens to be running at the time.
-	var jVM *C.JavaVM
-	if status := C.GetJavaVM(env, &jVM); status != 0 {
-		panic("couldn't get Java VM from the (Java) environment")
-	}
-	// Reference Java Signer; it will be de-referenced when the Go Signer
-	// created below is garbage-collected (through the finalizer callback we
-	// setup just below).
-	jSigner = C.NewGlobalRef(env, jSigner)
-	s := &signer{
-		jVM:     jVM,
-		jSigner: jSigner,
-	}
-	runtime.SetFinalizer(s, func(s *signer) {
-		envPtr, freeFunc := util.GetEnv(s.jVM)
-		env := (*C.JNIEnv)(envPtr)
-		defer freeFunc()
-		C.DeleteGlobalRef(env, s.jSigner)
-	})
-	return s
-}
-
-type signer struct {
-	jVM     *C.JavaVM
-	jSigner C.jobject
-}
-
-func (s *signer) Sign(message []byte) (security.Signature, error) {
-	envPtr, freeFunc := util.GetEnv(s.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	signatureSign := util.ClassSign("com.veyron2.security.Signature")
-	jSig, err := util.CallObjectMethod(env, s.jSigner, "sign", []util.Sign{util.ArraySign(util.ByteSign)}, signatureSign, message)
-	if err != nil {
-		return security.Signature{}, err
-	}
-	jHash := util.CallObjectMethodOrCatch(env, jSig, "getHash", nil, util.ClassSign("com.veyron2.security.Hash"))
-	sig := security.Signature{
-		Hash: security.Hash(util.CallStringMethodOrCatch(env, jHash, "getValue", nil)),
-		R:    util.CallByteArrayMethodOrCatch(env, jSig, "getR", nil),
-		S:    util.CallByteArrayMethodOrCatch(env, jSig, "getS", nil),
-	}
-	return sig, nil
-}
-
-func (s *signer) PublicKey() *ecdsa.PublicKey {
-	envPtr, freeFunc := util.GetEnv(s.jVM)
-	env := (*C.JNIEnv)(envPtr)
-	defer freeFunc()
-	publicKeySign := util.ClassSign("java.security.interfaces.ECPublicKey")
-	jPublicKey := C.jobject(util.CallObjectMethodOrCatch(env, s.jSigner, "publicKey", nil, publicKeySign))
-	// Get the encoded version of the public key.
-	encoded := util.CallByteArrayMethodOrCatch(env, jPublicKey, "getEncoded", nil)
-	key, err := parsePKIXPublicKey(encoded)
-	if err != nil {
-		panic("couldn't parse Java ECDSA public key: " + err.Error())
-	}
-	return key
-}
diff --git a/jni/runtimes/google/util/call.go b/jni/runtimes/google/util/call.go
deleted file mode 100644
index f054d7f..0000000
--- a/jni/runtimes/google/util/call.go
+++ /dev/null
@@ -1,294 +0,0 @@
-// +build android
-
-package util
-
-import (
-	"fmt"
-	"reflect"
-	"unsafe"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include <stdlib.h>
-// #include "jni_wrapper.h"
-//
-// static jvalue* allocJValueArray(int elements) {
-//   return malloc(sizeof(jvalue) * elements);
-// }
-//
-// static setJValueArrayElement(jvalue* arr, int index, jvalue val) {
-//   arr[index] = val;
-// }
-//
-import "C"
-
-// jValue converts a reflect value to a JNI jvalue (to use as an argument).
-func jValue(env *C.JNIEnv, rv reflect.Value) C.jvalue {
-	if rv.Kind() == reflect.Ptr || rv.Kind() == reflect.UnsafePointer {
-		rv = reflect.ValueOf(rv.Pointer()) // Convert the pointer's address to a uintptr
-	}
-	var ptr unsafe.Pointer
-	switch rv.Kind() {
-	case reflect.Int, reflect.Int64, reflect.Int32, reflect.Int16, reflect.Int8:
-		jv := C.jint(rv.Int())
-		ptr = unsafe.Pointer(&jv)
-	case reflect.Uintptr, reflect.Uint, reflect.Uint64, reflect.Uint32, reflect.Uint16, reflect.Uint8:
-		jv := C.jlong(rv.Uint())
-		ptr = unsafe.Pointer(&jv)
-	case reflect.String:
-		// JStringPtr allocates the strings locally, so they are freed automatically when we return to Java.
-		jv := JStringPtr(env, rv.String())
-		if jv == nil {
-			panic("JStringPtr failed to convert string.")
-		}
-		ptr = unsafe.Pointer(&jv)
-	case reflect.Slice, reflect.Array:
-		switch rv.Type().Elem().Kind() {
-		case reflect.Uint8:
-			bs := rv.Interface().([]byte)
-			jv := JByteArrayPtr(env, bs)
-			ptr = unsafe.Pointer(&jv)
-		case reflect.String:
-			// TODO(bprosnitz) We should handle objects by calling jValue recursively. We need a way to get the sign of the target type or treat it as an Object for non-string types.
-			strs := rv.Interface().([]string)
-			jv := JStringArrayPtr(env, strs)
-			ptr = unsafe.Pointer(&jv)
-		default:
-			panic(fmt.Sprintf("support for converting slice of kind %v not yet implemented", rv.Type().Elem().Kind()))
-		}
-	default:
-		panic(fmt.Sprintf("support for converting go value of kind %v not yet implemented", rv.Kind()))
-	}
-	if ptr == nil {
-		panic(fmt.Sprintf("unexpected nil ptr when converting to java value (kind was %v)", rv.Kind()))
-	}
-	return *(*C.jvalue)(ptr)
-}
-
-// jValueArray converts a slice of go values to JNI jvalues (the calling args).
-func jValueArray(env *C.JNIEnv, args []interface{}) (value *C.jvalue, free func()) {
-	jvalueArr := C.allocJValueArray(C.int(len(args)))
-	for i, item := range args {
-		jval := jValue(env, reflect.ValueOf(item))
-		C.setJValueArrayElement(jvalueArr, C.int(i), jval)
-	}
-
-	freeFunc := func() {
-		C.free(unsafe.Pointer(jvalueArr))
-	}
-	return jvalueArr, freeFunc
-}
-
-// NewObject calls a java constructor through JNI, passing the specified args.
-func NewObject(env interface{}, class interface{}, argSigns []Sign, args ...interface{}) (C.jobject, error) {
-	if class == nil {
-		panic("cannot call constructor of nil class")
-	}
-	jenv := getEnv(env)
-	jclass := getClass(class)
-
-	jcid := C.jmethodID(JMethodIDPtrOrDie(jenv, jclass, "<init>", FuncSign(argSigns, VoidSign)))
-
-	valArray, freeFunc := jValueArray(jenv, args)
-	defer freeFunc()
-
-	ret := C.NewObjectA(jenv, jclass, jcid, valArray)
-	err := JExceptionMsg(env)
-	return ret, err
-}
-
-// NewObjectOrCatch is a helper method that calls NewObject and panics if a Java exception occurred.
-func NewObjectOrCatch(env interface{}, class interface{}, argSigns []Sign, args ...interface{}) C.jobject {
-	obj, err := NewObject(env, class, argSigns, args...)
-	if err != nil {
-		panic(fmt.Sprintf("exception while creating jni object: %v", err))
-	}
-	return obj
-}
-
-// setupMethodCall performs the shared preparation operations between various java method invocation functions.
-func setupMethodCall(env interface{}, object interface{}, name string, argSigns []Sign, retSign Sign, args []interface{}) (jenv *C.JNIEnv, jobject C.jobject, jmid C.jmethodID, jvalArray *C.jvalue, freeFunc func()) {
-	jenv = getEnv(env)
-	jobject = getObject(object)
-	jclass := C.GetObjectClass(jenv, jobject)
-
-	jmid = C.jmethodID(JMethodIDPtrOrDie(jenv, jclass, name, FuncSign(argSigns, retSign)))
-
-	jvalArray, freeFunc = jValueArray(jenv, args)
-	return
-}
-
-// CallObjectMethod calls a java method over JNI that returns a java object.
-func CallObjectMethod(env interface{}, object interface{}, name string, argSigns []Sign, retSign Sign, args ...interface{}) (C.jobject, error) {
-	switch retSign {
-	case ByteSign, CharSign, ShortSign, LongSign, FloatSign, DoubleSign, BoolSign, IntSign, VoidSign:
-		panic(fmt.Sprintf("Illegal call to CallObjectMethod on method with return sign %s", retSign))
-	}
-	jenv, jobject, jmid, valArray, freeFunc := setupMethodCall(env, object, name, argSigns, retSign, args)
-	defer freeFunc()
-	ret := C.CallObjectMethodA(jenv, jobject, jmid, valArray)
-	return ret, JExceptionMsg(env)
-}
-
-// CallStringMethod calls a java method over JNI that returns a string.
-func CallStringMethod(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) (string, error) {
-	jstr, err := CallObjectMethod(env, object, name, argSigns, StringSign, args...)
-	return GoString(env, jstr), err
-}
-
-// CallByteArrayMethod calls a java method over JNI that returns a byte array.
-func CallByteArrayMethod(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) ([]byte, error) {
-	jArr, err := CallObjectMethod(env, object, name, argSigns, ArraySign(ByteSign), args...)
-	if err != nil {
-		return nil, err
-	}
-	return GoByteArray(env, jArr), nil
-}
-
-// CallObjectArrayMethod calls a java method over JNI that returns an object array.
-func CallObjectArrayMethod(env interface{}, object interface{}, name string, argSigns []Sign, retSign Sign, args ...interface{}) ([]C.jobject, error) {
-	if retSign == "" || retSign[0] != '[' {
-		panic(fmt.Sprintf("Expected object array, got: %v", retSign))
-	}
-	jenv := getEnv(env)
-	jarr, err := CallObjectMethod(env, object, name, argSigns, retSign, args...)
-	garr := make([]C.jobject, int(C.GetArrayLength(jenv, C.jarray(jarr))))
-	for i, _ := range garr {
-		garr[i] = C.jobject(C.GetObjectArrayElement(jenv, C.jobjectArray(jarr), C.jsize(i)))
-	}
-	return garr, err
-}
-
-// CallStringArrayMethod calls a java method over JNI that returns an string array.
-func CallStringArrayMethod(env interface{}, object interface{}, name string, argSigns []Sign, retSign Sign, args ...interface{}) ([]string, error) {
-	objarr, err := CallObjectArrayMethod(env, object, name, argSigns, retSign, args...)
-	strs := make([]string, len(objarr))
-	for i, obj := range objarr {
-		strs[i] = GoString(env, obj)
-	}
-	return strs, err
-}
-
-// CallBooleanMethod calls a java method over JNI that returns a boolean.
-func CallBooleanMethod(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) (bool, error) {
-	jenv, jobject, jmid, valArray, freeFunc := setupMethodCall(env, object, name, argSigns, BoolSign, args)
-	defer freeFunc()
-	ret := C.CallBooleanMethodA(jenv, jobject, jmid, valArray) != C.JNI_OK
-	return ret, JExceptionMsg(env)
-}
-
-// CallIntMethod calls a java method over JNI that returns an int.
-func CallIntMethod(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) (int, error) {
-	jenv, jobject, jmid, valArray, freeFunc := setupMethodCall(env, object, name, argSigns, IntSign, args)
-	defer freeFunc()
-	ret := int(C.CallIntMethodA(jenv, jobject, jmid, valArray))
-	return ret, JExceptionMsg(env)
-}
-
-// CallLongMethod calls a java method over JNI that returns an int64.
-func CallLongMethod(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) (int64, error) {
-	jenv, jobject, jmid, valArray, freeFunc := setupMethodCall(env, object, name, argSigns, LongSign, args)
-	defer freeFunc()
-	ret := int64(C.CallLongMethodA(jenv, jobject, jmid, valArray))
-	return ret, JExceptionMsg(env)
-}
-
-// CallVoidMethod calls a java method over JNI that "returns" void.
-func CallVoidMethod(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) error {
-	jenv, jobject, jmid, valArray, freeFunc := setupMethodCall(env, object, name, argSigns, VoidSign, args)
-	C.CallVoidMethodA(jenv, jobject, jmid, valArray)
-	freeFunc()
-	return JExceptionMsg(env)
-}
-
-// CallObjectMethodOrCatch is a helper method that calls CallObjectMethod and panics if a Java exception occurred.
-func CallObjectMethodOrCatch(env interface{}, object interface{}, name string, argSigns []Sign, retSign Sign, args ...interface{}) C.jobject {
-	obj, err := CallObjectMethod(env, object, name, argSigns, retSign, args...)
-	handleException(name, err)
-	return obj
-}
-
-// CallStringMethodOrCatch is a helper method that calls CallStringMethod and panics if a Java exception occurred.
-func CallStringMethodOrCatch(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) string {
-	str, err := CallStringMethod(env, object, name, argSigns, args...)
-	handleException(name, err)
-	return str
-}
-
-// CallByteArrayMethodOrCatch is a helper method that calls CallByteArrayMethod and panics if a Java exception occurred.
-func CallByteArrayMethodOrCatch(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) []byte {
-	arr, err := CallByteArrayMethod(env, object, name, argSigns, args...)
-	handleException(name, err)
-	return arr
-}
-
-// CallObjectArrayMethodOrCatch is a helper method that calls CallObjectArrayMethod and panics if a Java exception occurred.
-func CallObjectArrayMethodOrCatch(env interface{}, object interface{}, name string, argSigns []Sign, retSign Sign, args ...interface{}) []C.jobject {
-	objs, err := CallObjectArrayMethod(env, object, name, argSigns, retSign, args...)
-	handleException(name, err)
-	return objs
-}
-
-// CallStringArrayMethodOrCatch is a helper method that calls CallStringArrayMethod and panics if a Java exception occurred.
-func CallStringArrayMethodOrCatch(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) []string {
-	strs, err := CallStringArrayMethod(env, object, name, argSigns, ArraySign(StringSign), args...)
-	handleException(name, err)
-	return strs
-}
-
-// CallBooleanMethodOrCatch is a helper method that calls CallBooleanMethod and panics if a Java exception occurred.
-func CallBooleanMethodOrCatch(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) bool {
-	b, err := CallBooleanMethod(env, object, name, argSigns, args...)
-	handleException(name, err)
-	return b
-}
-
-// CallIntMethodOrCatch is a helper method that calls CallIntMethod and panics if a Java exception occurred.
-func CallIntMethodOrCatch(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) int {
-	i, err := CallIntMethod(env, object, name, argSigns, args...)
-	handleException(name, err)
-	return i
-}
-
-// CallLongMethodOrCatch is a helper method that calls CallLongMethod and panics if a Java exception occurred.
-func CallLongMethodOrCatch(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) int64 {
-	l, err := CallLongMethod(env, object, name, argSigns, args...)
-	handleException(name, err)
-	return l
-}
-
-// CallVoidMethodOrCatch is a helper method that calls CallVoidMethod and panics if a Java exception occurred.
-func CallVoidMethodOrCatch(env interface{}, object interface{}, name string, argSigns []Sign, args ...interface{}) {
-	err := CallVoidMethod(env, object, name, argSigns, args...)
-	handleException(name, err)
-}
-
-// CallStaticObjectMethod calls a static java method over JNI that returns a java object.
-func CallStaticObjectMethod(env interface{}, class interface{}, name string, argSigns []Sign, retSign Sign, args ...interface{}) (C.jobject, error) {
-	switch retSign {
-	case ByteSign, CharSign, ShortSign, LongSign, FloatSign, DoubleSign, BoolSign, IntSign, VoidSign:
-		panic(fmt.Sprintf("Illegal call to CallObjectMethod on method with return sign %s", retSign))
-	}
-	jenv := getEnv(env)
-	jclass := getClass(class)
-
-	jmid := C.jmethodID(JMethodIDPtrOrDie(jenv, jclass, name, FuncSign(argSigns, retSign)))
-
-	jvalArray, freeFunc := jValueArray(jenv, args)
-	ret := C.CallStaticObjectMethodA(jenv, jclass, jmid, jvalArray)
-	freeFunc()
-	return ret, JExceptionMsg(env)
-}
-
-// CallStaticObjectMethodOrCatch is a helper method that calls CallStaticObjectMethod and panics if a Java exception occurred.
-func CallStaticObjectMethodOrCatch(env interface{}, class interface{}, name string, argSigns []Sign, retSign Sign, args ...interface{}) C.jobject {
-	obj, err := CallStaticObjectMethod(env, class, name, argSigns, retSign, args...)
-	handleException(name, err)
-	return obj
-}
-
-func handleException(name string, err error) {
-	if err != nil {
-		panic(fmt.Sprintf("exception while calling jni method %q: %v", name, err))
-	}
-}
diff --git a/jni/runtimes/google/util/sign.go b/jni/runtimes/google/util/sign.go
deleted file mode 100644
index 8624569..0000000
--- a/jni/runtimes/google/util/sign.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package util
-
-import (
-	"bytes"
-	"strings"
-)
-
-type Sign string
-
-const (
-	// VoidSign denotes a signature of a Java void type.
-	VoidSign Sign = "V"
-	// ByteSign denotes a signature of a Java byte type.
-	ByteSign Sign = "B"
-	// BoolSign denotes a signature of a Java boolean type.
-	BoolSign Sign = "Z"
-	// CharSign denotes a signature of a Java char type.
-	CharSign Sign = "C"
-	// ShortSign denotes a signature of a Java short type.
-	ShortSign Sign = "S"
-	// IntSign denotes a signature of a Java int type.
-	IntSign Sign = "I"
-	// LongSign denotes a signature of a Java long type.
-	LongSign Sign = "J"
-	// FloatSign denotes a signature of a Java float type.
-	FloatSign Sign = "F"
-	// DoubleSign denotes a signature of a Java double type.
-	DoubleSign Sign = "D"
-)
-
-var (
-	// StringSign denotes a signature of a Java String type.
-	StringSign = ClassSign("java.lang.String")
-	// ObjectSign denotes a signature of a Java Object type.
-	ObjectSign = ClassSign("java.lang.Object")
-)
-
-// ArraySign returns the array signature, given the underlying array type.
-func ArraySign(sign Sign) Sign {
-	return "[" + sign
-}
-
-// ClassSign returns the signature of the specified Java class.
-// The class should be specified in java "java.lang.String" style.
-func ClassSign(className string) Sign {
-	return Sign("L" + strings.Replace(className, ".", "/", -1) + ";")
-}
-
-// FuncSign returns the signature of the specified java function.
-func FuncSign(argSigns []Sign, retSign Sign) Sign {
-	var buf bytes.Buffer
-	buf.WriteRune('(')
-	for _, sign := range argSigns {
-		buf.WriteString(string(sign))
-	}
-	buf.WriteRune(')')
-	buf.WriteString(string(retSign))
-	return Sign(buf.String())
-}
diff --git a/jni/runtimes/google/util/sign_test.go b/jni/runtimes/google/util/sign_test.go
deleted file mode 100644
index 9b63a9c..0000000
--- a/jni/runtimes/google/util/sign_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package util
-
-import "testing"
-
-func TestSigns(t *testing.T) {
-	tests := []struct {
-		input  Sign
-		output string
-	}{
-		{ClassSign("java.lang.Object"), "Ljava/lang/Object;"},
-		{ClassSign("java.lang.String"), "Ljava/lang/String;"},
-		{ArraySign(ObjectSign), "[Ljava/lang/Object;"},
-		{ArraySign(StringSign), "[Ljava/lang/String;"},
-		{ArraySign(IntSign), "[I"},
-		{FuncSign(nil, IntSign), "()I"},
-		{FuncSign([]Sign{}, IntSign), "()I"},
-		{FuncSign([]Sign{BoolSign}, VoidSign), "(Z)V"},
-		{FuncSign([]Sign{CharSign, ByteSign, ShortSign}, FloatSign), "(CBS)F"},
-		{FuncSign([]Sign{ClassSign("com.veyron.testing.misc")}, ClassSign("com.veyron.ret")), "(Lcom/veyron/testing/misc;)Lcom/veyron/ret;"},
-		{FuncSign([]Sign{ClassSign("com.veyron.testing.misc"), ClassSign("other")}, ClassSign("com.veyron.ret")), "(Lcom/veyron/testing/misc;Lother;)Lcom/veyron/ret;"},
-	}
-	for _, test := range tests {
-		output := string(test.input)
-		if output != test.output {
-			t.Errorf("expected %v, got %v", test.output, output)
-		}
-	}
-}
diff --git a/jni/runtimes/google/util/util.go b/jni/runtimes/google/util/util.go
deleted file mode 100644
index 284f620..0000000
--- a/jni/runtimes/google/util/util.go
+++ /dev/null
@@ -1,471 +0,0 @@
-// +build android
-
-// Package util provides various JNI utilities shared across our JNI code.
-package util
-
-import (
-	"errors"
-	"fmt"
-	"reflect"
-	"sync"
-	"unicode"
-	"unicode/utf8"
-	"unsafe"
-
-	"veyron2/verror"
-)
-
-// #cgo LDFLAGS: -ljniwrapper
-// #include <stdlib.h>
-// #include "jni_wrapper.h"
-// // CGO doesn't support variadic functions so we have to hard-code these
-// // functions to match the invoking code. Ugh!
-// static jobject CallNewVeyronExceptionObject(JNIEnv* env, jclass class, jmethodID mid, jstring msg, jstring id) {
-//   return (*env)->NewObject(env, class, mid, msg, id);
-// }
-// static jstring CallGetExceptionMessage(JNIEnv* env, jobject obj, jmethodID id) {
-//   return (jstring)(*env)->CallObjectMethod(env, obj, id);
-// }
-import "C"
-
-var (
-	// Global reference for com.veyron2.ipc.VeyronException class.
-	jVeyronExceptionClass C.jclass
-	// Global reference for java.lang.Throwable class.
-	jThrowableClass C.jclass
-	// Global reference for java.lang.String class.
-	jStringClass C.jclass
-)
-
-// Init initializes the JNI code with the given Java environment.  This method
-// must be invoked before any other method in this package and must be called
-// from the main Java thread (e.g., On_Load()).
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func Init(jEnv interface{}) {
-	env := getEnv(jEnv)
-	jVeyronExceptionClass = C.jclass(JFindClassPtrOrDie(env, "com/veyron2/ipc/VeyronException"))
-	jThrowableClass = C.jclass(JFindClassPtrOrDie(env, "java/lang/Throwable"))
-	jStringClass = C.jclass(JFindClassPtrOrDie(env, "java/lang/String"))
-}
-
-// GoRef creates a new reference to the value addressed by the provided pointer.
-// The value will remain referenced until it is explicitly unreferenced using
-// goUnref().
-func GoRef(valptr interface{}) {
-	if !IsPointer(valptr) {
-		panic("must pass pointer value to goRef")
-	}
-	refs.insert(valptr)
-}
-
-// GoUnref removes a previously added reference to the value addressed by the
-// provided pointer.  If the value hasn't been ref-ed (a bug?), this unref will
-// be a no-op.
-func GoUnref(valptr interface{}) {
-	if !IsPointer(valptr) {
-		panic("must pass pointer value to goUnref")
-	}
-	refs.delete(valptr)
-}
-
-// IsPointer returns true iff the provided value is a pointer.
-func IsPointer(val interface{}) bool {
-	return reflect.ValueOf(val).Kind() == reflect.Ptr
-}
-
-// DerefOrDie dereferences the provided (pointer) value, or panic-s if the value
-// isn't of pointer type.
-func DerefOrDie(i interface{}) interface{} {
-	v := reflect.ValueOf(i)
-	if v.Kind() != reflect.Ptr {
-		panic(fmt.Sprintf("want reflect.Ptr value for %v, have %v", i, v.Kind()))
-	}
-	return v.Elem().Interface()
-}
-
-// Ptr returns the value of the provided Java pointer (of type C.jlong) as an
-// unsafe.Pointer.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func Ptr(jPtr interface{}) unsafe.Pointer {
-	v := reflect.ValueOf(jPtr)
-	return unsafe.Pointer(uintptr(v.Int()))
-}
-
-// PtrValue returns the value of the pointer as a uintptr.
-func PtrValue(ptr interface{}) uintptr {
-	v := reflect.ValueOf(ptr)
-	if v.Kind() != reflect.Ptr && v.Kind() != reflect.UnsafePointer {
-		panic("must pass pointer value to PtrValue")
-	}
-	return v.Pointer()
-}
-
-// CamelCase converts ThisString to thisString.
-func CamelCase(s string) string {
-	if s == "" {
-		return ""
-	}
-	r, n := utf8.DecodeRuneInString(s)
-	return string(unicode.ToLower(r)) + s[n:]
-}
-
-// GoString returns a Go string given the Java string.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func GoString(jEnv, jStr interface{}) string {
-	env := getEnv(jEnv)
-	str := getString(jStr)
-	if str == nil {
-		return ""
-	}
-	cString := C.GetStringUTFChars(env, str, nil)
-	defer C.ReleaseStringUTFChars(env, str, cString)
-	return C.GoString(cString)
-}
-
-// GetEnv returns the Java environment for the running thread, creating a new
-// one if it doesn't already exist.  This method also returns a function which
-// must be invoked when the returned environment is no longer needed. The
-// returned environment can only be used by the thread that invoked this method,
-// and the function must be invoked by the same thread as well.
-func GetEnv(javaVM interface{}) (jEnv unsafe.Pointer, free func()) {
-	jVM := getJVM(javaVM)
-	var env *C.JNIEnv
-	if C.GetEnv(jVM, &env, C.JNI_VERSION_1_6) == C.JNI_OK {
-		return unsafe.Pointer(env), func() {}
-	}
-	// Couldn't get env, attach the thread.
-	C.AttachCurrentThread(jVM, &env, nil)
-	return unsafe.Pointer(env), func() {
-		C.DetachCurrentThread(jVM)
-	}
-}
-
-// JString returns a Java string given the Go string.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JStringPtr(jEnv interface{}, str string) unsafe.Pointer {
-	env := getEnv(jEnv)
-	cString := C.CString(str)
-	defer C.free(unsafe.Pointer(cString))
-	return unsafe.Pointer(C.NewStringUTF(env, cString))
-}
-
-// JThrow throws a new Java exception of the provided type with the given message.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JThrow(jEnv, jClass interface{}, msg string) {
-	env := getEnv(jEnv)
-	class := getClass(jClass)
-	s := C.CString(msg)
-	defer C.free(unsafe.Pointer(s))
-	C.ThrowNew(env, class, s)
-}
-
-// JThrowV throws a new Java VeyronException corresponding to the given error.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JThrowV(jEnv interface{}, err error) {
-	env := getEnv(jEnv)
-	verr := verror.Convert(err)
-	id := C.jmethodID(JMethodIDPtrOrDie(env, jVeyronExceptionClass, "<init>", FuncSign([]Sign{StringSign, StringSign}, VoidSign)))
-	obj := C.jthrowable(C.CallNewVeyronExceptionObject(env, jVeyronExceptionClass, id, C.jstring(JStringPtr(env, verr.Error())), C.jstring(JStringPtr(env, string(verr.ErrorID())))))
-	C.Throw(env, obj)
-}
-
-// JExceptionMsg returns the exception message if an exception occurred, or
-// nil otherwise.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JExceptionMsg(jEnv interface{}) error {
-	env := getEnv(jEnv)
-	e := C.ExceptionOccurred(env)
-	if e == nil { // no exception
-		return nil
-	}
-	C.ExceptionClear(env)
-	id := C.jmethodID(JMethodIDPtrOrDie(env, jThrowableClass, "getMessage", FuncSign(nil, StringSign)))
-	jMsg := C.CallGetExceptionMessage(env, C.jobject(e), id)
-	return errors.New(GoString(env, jMsg))
-}
-
-// JObjectFieldPtr returns the value of the provided Java object's Object field.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JObjectFieldPtr(jEnv, jObj interface{}, field string) unsafe.Pointer {
-	env := getEnv(jEnv)
-	obj := getObject(jObj)
-	fid := C.jfieldID(JFieldIDPtrOrDie(env, C.GetObjectClass(env, obj), field, ObjectSign))
-	return unsafe.Pointer(C.GetObjectField(env, obj, fid))
-}
-
-// JBoolField returns the value of the provided Java object's boolean field.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JBoolField(jEnv, jObj interface{}, field string) bool {
-	env := getEnv(jEnv)
-	obj := getObject(jObj)
-	fid := C.jfieldID(JFieldIDPtrOrDie(env, C.GetObjectClass(env, obj), field, BoolSign))
-	return C.GetBooleanField(env, obj, fid) != C.JNI_FALSE
-}
-
-// JIntField returns the value of the provided Java object's int field.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JIntField(jEnv, jObj interface{}, field string) int {
-	env := getEnv(jEnv)
-	obj := getObject(jObj)
-	fid := C.jfieldID(JFieldIDPtrOrDie(env, C.GetObjectClass(env, obj), field, IntSign))
-	return int(C.GetIntField(env, obj, fid))
-}
-
-// JStringField returns the value of the provided Java object's String field,
-// as a Go string.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JStringField(jEnv, jObj interface{}, field string) string {
-	env := getEnv(jEnv)
-	obj := getObject(jObj)
-	fid := C.jfieldID(JFieldIDPtrOrDie(env, C.GetObjectClass(env, obj), field, StringSign))
-	jStr := C.jstring(C.GetObjectField(env, obj, fid))
-	return GoString(env, jStr)
-}
-
-// JStringArrayField returns the value of the provided object's String[] field,
-// as a slice of Go strings.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JStringArrayField(jEnv, jObj interface{}, field string) []string {
-	env := getEnv(jEnv)
-	obj := getObject(jObj)
-	fid := C.jfieldID(JFieldIDPtrOrDie(env, C.GetObjectClass(env, obj), field, ArraySign(StringSign)))
-	jStrArray := C.jobjectArray(C.GetObjectField(env, obj, fid))
-	return GoStringArray(env, jStrArray)
-}
-
-// JByteArrayField returns the value of the provided object's byte[] field as a
-// Go byte slice.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JByteArrayField(jEnv, jObj interface{}, field string) []byte {
-	env := getEnv(jEnv)
-	obj := getObject(jObj)
-	fid := C.jfieldID(JFieldIDPtrOrDie(env, C.GetObjectClass(env, obj), field, ArraySign(ByteSign)))
-	arr := C.jbyteArray(C.GetObjectField(env, obj, fid))
-	if arr == nil {
-		return nil
-	}
-	return GoByteArray(env, arr)
-}
-
-// JStaticStringField returns the value of the static String field of the
-// provided Java class, as a Go string.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JStaticStringField(jEnv, jClass interface{}, field string) string {
-	env := getEnv(jEnv)
-	class := getClass(jClass)
-	fid := C.jfieldID(JStaticFieldIDPtrOrDie(env, class, field, StringSign))
-	jStr := C.jstring(C.GetStaticObjectField(env, class, fid))
-	return GoString(env, jStr)
-}
-
-// JStringArray converts the provided slice of Go strings into a Java array of strings.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JStringArrayPtr(jEnv interface{}, strs []string) unsafe.Pointer {
-	env := getEnv(jEnv)
-	ret := C.NewObjectArray(env, C.jsize(len(strs)), jStringClass, nil)
-	for i, str := range strs {
-		C.SetObjectArrayElement(env, ret, C.jsize(i), C.jobject(JStringPtr(env, str)))
-	}
-	return unsafe.Pointer(ret)
-}
-
-// GoStringArray converts a Java string array to a Go string array.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func GoStringArray(jEnv, jStrArray interface{}) []string {
-	env := getEnv(jEnv)
-	jArr := getObjectArray(jStrArray)
-	if jArr == nil {
-		return nil
-	}
-	length := C.GetArrayLength(env, C.jarray(jArr))
-	ret := make([]string, int(length))
-	for i := 0; i < int(length); i++ {
-		ret[i] = GoString(env, C.jstring(C.GetObjectArrayElement(env, jArr, C.jsize(i))))
-	}
-	return ret
-}
-
-// JByteArray converts the provided Go byte slice into a Java byte array.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JByteArrayPtr(jEnv interface{}, bytes []byte) unsafe.Pointer {
-	env := getEnv(jEnv)
-	ret := C.NewByteArray(env, C.jsize(len(bytes)))
-	C.SetByteArrayRegion(env, ret, 0, C.jsize(len(bytes)), (*C.jbyte)(unsafe.Pointer(&bytes[0])))
-	return unsafe.Pointer(ret)
-}
-
-// GoByteArray converts the provided Java byte array into a Go byte slice.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func GoByteArray(jEnv, jArr interface{}) (ret []byte) {
-	env := getEnv(jEnv)
-	arr := getByteArray(jArr)
-	length := int(C.GetArrayLength(env, C.jarray(arr)))
-	ret = make([]byte, length)
-	bytes := C.GetByteArrayElements(env, arr, nil)
-	for i := 0; i < length; i++ {
-		ret[i] = byte(*bytes)
-		bytes = (*C.jbyte)(unsafe.Pointer(uintptr(unsafe.Pointer(bytes)) + unsafe.Sizeof(*bytes)))
-	}
-	return
-}
-
-// JFieldIDPtrOrDie returns the Java field ID for the given object
-// (i.e., non-static) field.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JFieldIDPtrOrDie(jEnv, jClass interface{}, name string, sign Sign) unsafe.Pointer {
-	env := getEnv(jEnv)
-	class := getClass(jClass)
-	cName := C.CString(name)
-	defer C.free(unsafe.Pointer(cName))
-	cSign := C.CString(string(sign))
-	defer C.free(unsafe.Pointer(cSign))
-	ptr := unsafe.Pointer(C.GetFieldID(env, class, cName, cSign))
-	if err := JExceptionMsg(env); err != nil || ptr == nil {
-		panic(fmt.Sprintf("couldn't find field %s: %v", name, err))
-	}
-	return ptr
-}
-
-// JStaticFieldIDPtrOrDie returns the Java field ID for the given static field.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JStaticFieldIDPtrOrDie(jEnv, jClass interface{}, name string, sign Sign) unsafe.Pointer {
-	env := getEnv(jEnv)
-	class := getClass(jClass)
-	cName := C.CString(name)
-	defer C.free(unsafe.Pointer(cName))
-	cSign := C.CString(string(sign))
-	defer C.free(unsafe.Pointer(cSign))
-	ptr := unsafe.Pointer(C.GetStaticFieldID(env, class, cName, cSign))
-	if err := JExceptionMsg(env); err != nil || ptr == nil {
-		panic(fmt.Sprintf("couldn't find field %s: %v", name, err))
-	}
-	return ptr
-}
-
-// JMethodIDPtrOrDie returns the Java method ID for the given method.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JMethodIDPtrOrDie(jEnv, jClass interface{}, name string, signature Sign) unsafe.Pointer {
-	env := getEnv(jEnv)
-	class := getClass(jClass)
-	cName := C.CString(name)
-	defer C.free(unsafe.Pointer(cName))
-	cSignature := C.CString(string(signature))
-	defer C.free(unsafe.Pointer(cSignature))
-	ptr := unsafe.Pointer(C.GetMethodID(env, class, cName, cSignature))
-	if err := JExceptionMsg(env); err != nil || ptr == nil {
-		panic(fmt.Sprintf("couldn't find method %s: %v", name, err))
-	}
-	return ptr
-}
-
-// JFindClasPtrsOrDie returns the global references to the Java class with the
-// given pathname, or panic-s if the class cannot be found.
-// NOTE: Because CGO creates package-local types and because this method may be
-// invoked from a different package, Java types are passed in an empty interface
-// and then cast into their package local types.
-func JFindClassPtrOrDie(jEnv interface{}, name string) unsafe.Pointer {
-	env := getEnv(jEnv)
-	cName := C.CString(name)
-	defer C.free(unsafe.Pointer(cName))
-	class := C.FindClass(env, cName)
-	if err := JExceptionMsg(env); err != nil || class == nil {
-		panic(fmt.Sprintf("couldn't find class %s: %v", name, err))
-	}
-	return unsafe.Pointer(C.NewGlobalRef(env, C.jobject(class)))
-}
-
-// refs stores references to instances of various Go types, namely instances
-// that are referenced only by the Java code.  The only purpose of this store
-// is to prevent Go runtime from garbage collecting those instances.
-var refs = newSafeSet()
-
-// newSafeSet returns a new instance of a thread-safe set.
-func newSafeSet() *safeSet {
-	return &safeSet{
-		items: make(map[interface{}]bool),
-	}
-}
-
-// safeSet is a thread-safe set.
-type safeSet struct {
-	lock  sync.Mutex
-	items map[interface{}]bool
-}
-
-func (s *safeSet) insert(item interface{}) {
-	s.lock.Lock()
-	defer s.lock.Unlock()
-	s.items[item] = true
-}
-
-func (s *safeSet) delete(item interface{}) {
-	s.lock.Lock()
-	defer s.lock.Unlock()
-	delete(s.items, item)
-}
-
-// Various functions that cast CGO types from various other packages into this
-// package's types.
-func getEnv(jEnv interface{}) *C.JNIEnv {
-	return (*C.JNIEnv)(unsafe.Pointer(PtrValue(jEnv)))
-}
-func getJVM(jVM interface{}) *C.JavaVM {
-	return (*C.JavaVM)(unsafe.Pointer(PtrValue(jVM)))
-}
-func getByteArray(jByteArray interface{}) C.jbyteArray {
-	return C.jbyteArray(unsafe.Pointer(PtrValue(jByteArray)))
-}
-func getObject(jObj interface{}) C.jobject {
-	return C.jobject(unsafe.Pointer(PtrValue(jObj)))
-}
-func getClass(jClass interface{}) C.jclass {
-	return C.jclass(unsafe.Pointer(PtrValue(jClass)))
-}
-func getString(jString interface{}) C.jstring {
-	return C.jstring(unsafe.Pointer(PtrValue(jString)))
-}
-func getObjectArray(jArray interface{}) C.jobjectArray {
-	return C.jobjectArray(unsafe.Pointer(PtrValue(jArray)))
-}