flow/manager: Fix caching of connections.

Connections should not be keyed by blessingNames, instead the
blessingNames are compared upon retrieval from the cache (only
if the conn is not to a proxy).

This ensures that connections to proxies from servers aren't replaced
from the cache when a server makes a connection through the proxy
(acting as a client). The blessings of the end server were incorrectly
being used in the caching of connection to the proxy.

Change-Id: I4a30f3610820be6dd704095653612481bebff627
diff --git a/runtime/factories/android/android.go b/runtime/factories/android/android.go
index 0f2437a..e09c89d 100644
--- a/runtime/factories/android/android.go
+++ b/runtime/factories/android/android.go
@@ -26,14 +26,14 @@
 	"v.io/x/ref/lib/pubsub"
 	"v.io/x/ref/lib/security/securityflag"
 	"v.io/x/ref/runtime/internal"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/tcp"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/ws"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/wsh"
 	"v.io/x/ref/runtime/internal/lib/appcycle"
 	"v.io/x/ref/runtime/internal/lib/roaming"
 	"v.io/x/ref/runtime/internal/lib/websocket"
 	"v.io/x/ref/runtime/internal/lib/xwebsocket"
 	"v.io/x/ref/runtime/internal/rt"
+	_ "v.io/x/ref/runtime/protocols/tcp"
+	_ "v.io/x/ref/runtime/protocols/ws"
+	_ "v.io/x/ref/runtime/protocols/wsh"
 	"v.io/x/ref/services/debug/debuglib"
 
 	// TODO(suharshs): Remove these once we switch to the flow protocols.
diff --git a/runtime/factories/chrome/chrome.go b/runtime/factories/chrome/chrome.go
index 0107639..9408d82 100644
--- a/runtime/factories/chrome/chrome.go
+++ b/runtime/factories/chrome/chrome.go
@@ -16,11 +16,11 @@
 
 	"v.io/x/ref/lib/flags"
 	"v.io/x/ref/runtime/internal"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/ws"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/wsh_nacl"
 	"v.io/x/ref/runtime/internal/lib/websocket"
 	"v.io/x/ref/runtime/internal/lib/xwebsocket"
 	grt "v.io/x/ref/runtime/internal/rt"
+	_ "v.io/x/ref/runtime/protocols/ws"
+	_ "v.io/x/ref/runtime/protocols/wsh_nacl"
 
 	// TODO(suharshs): Remove this after we switch to the flow protocols.
 	_ "v.io/x/ref/runtime/internal/rpc/protocols/ws"
diff --git a/runtime/factories/fake/fake.go b/runtime/factories/fake/fake.go
index 0972209..4fd788e 100644
--- a/runtime/factories/fake/fake.go
+++ b/runtime/factories/fake/fake.go
@@ -17,17 +17,17 @@
 	"v.io/v23/rpc"
 
 	"v.io/x/ref/runtime/internal"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/tcp"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/ws"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/wsh"
 	"v.io/x/ref/runtime/internal/lib/websocket"
 	"v.io/x/ref/runtime/internal/lib/xwebsocket"
+	_ "v.io/x/ref/runtime/protocols/tcp"
+	_ "v.io/x/ref/runtime/protocols/ws"
+	_ "v.io/x/ref/runtime/protocols/wsh"
 
 	// TODO(suharshs): Remove these once we switch to the flow protocols.
-	_ "v.io/x/ref/runtime/internal/flow/protocols/local"
 	_ "v.io/x/ref/runtime/internal/rpc/protocols/tcp"
 	_ "v.io/x/ref/runtime/internal/rpc/protocols/ws"
 	_ "v.io/x/ref/runtime/internal/rpc/protocols/wsh"
+	_ "v.io/x/ref/runtime/protocols/local"
 )
 
 var (
diff --git a/runtime/factories/gce/gce.go b/runtime/factories/gce/gce.go
index 91268e0..eb892c3 100644
--- a/runtime/factories/gce/gce.go
+++ b/runtime/factories/gce/gce.go
@@ -21,14 +21,14 @@
 	"v.io/x/lib/netstate"
 	"v.io/x/ref/lib/flags"
 	"v.io/x/ref/runtime/internal"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/tcp"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/ws"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/wsh"
 	"v.io/x/ref/runtime/internal/gce"
 	"v.io/x/ref/runtime/internal/lib/appcycle"
 	"v.io/x/ref/runtime/internal/lib/websocket"
 	"v.io/x/ref/runtime/internal/lib/xwebsocket"
 	grt "v.io/x/ref/runtime/internal/rt"
+	_ "v.io/x/ref/runtime/protocols/tcp"
+	_ "v.io/x/ref/runtime/protocols/ws"
+	_ "v.io/x/ref/runtime/protocols/wsh"
 
 	// TODO(suharshs): Remove these once we switch to the flow protocols.
 	_ "v.io/x/ref/runtime/internal/rpc/protocols/tcp"
diff --git a/runtime/factories/generic/generic.go b/runtime/factories/generic/generic.go
index 4ecdd27..d6513dc 100644
--- a/runtime/factories/generic/generic.go
+++ b/runtime/factories/generic/generic.go
@@ -17,13 +17,13 @@
 	dfactory "v.io/x/ref/lib/discovery/factory"
 	"v.io/x/ref/lib/flags"
 	"v.io/x/ref/runtime/internal"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/tcp"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/ws"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/wsh"
 	"v.io/x/ref/runtime/internal/lib/appcycle"
 	"v.io/x/ref/runtime/internal/lib/websocket"
 	"v.io/x/ref/runtime/internal/lib/xwebsocket"
 	grt "v.io/x/ref/runtime/internal/rt"
+	_ "v.io/x/ref/runtime/protocols/tcp"
+	_ "v.io/x/ref/runtime/protocols/ws"
+	_ "v.io/x/ref/runtime/protocols/wsh"
 
 	// TODO(suharshs): Remove these once we switch to the flow protocols.
 	_ "v.io/x/ref/runtime/internal/rpc/protocols/tcp"
diff --git a/runtime/factories/roaming/roaming.go b/runtime/factories/roaming/roaming.go
index 7a2703d..c6c0fe3 100644
--- a/runtime/factories/roaming/roaming.go
+++ b/runtime/factories/roaming/roaming.go
@@ -27,14 +27,14 @@
 	"v.io/x/ref/lib/pubsub"
 	"v.io/x/ref/lib/security/securityflag"
 	"v.io/x/ref/runtime/internal"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/tcp"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/ws"
-	_ "v.io/x/ref/runtime/internal/flow/protocols/wsh"
 	"v.io/x/ref/runtime/internal/lib/appcycle"
 	"v.io/x/ref/runtime/internal/lib/roaming"
 	"v.io/x/ref/runtime/internal/lib/websocket"
 	"v.io/x/ref/runtime/internal/lib/xwebsocket"
 	"v.io/x/ref/runtime/internal/rt"
+	_ "v.io/x/ref/runtime/protocols/tcp"
+	_ "v.io/x/ref/runtime/protocols/ws"
+	_ "v.io/x/ref/runtime/protocols/wsh"
 	"v.io/x/ref/services/debug/debuglib"
 
 	// TODO(suharshs): Remove these once we switch to the flow protocols.