update rpc to be more flexible with underlying implementation, implement connect side of the secure protocol