Skip to content

Commit

Permalink
Move code from RealConnection to RealConnectPlan (#7065)
Browse files Browse the repository at this point in the history
* Move code from RealConnection to RealConnectPlan

Also promote RealConnectPlan to a top-level type, ConnectPlan.

Each RealConnection is now created only once its ready to be used
to carry exchanges. We do the actual connect work in ConnectPlan.

* Move startHttp2() back to RealConnection

* Update FastFallbackExchangeFinder for split RealConnection
  • Loading branch information
squarejesse authored Feb 10, 2022
1 parent 7620f3d commit 699a212
Show file tree
Hide file tree
Showing 16 changed files with 793 additions and 715 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import okhttp3.internal.concurrent.TaskRunner
import okhttp3.internal.connection.RealCall
import okhttp3.internal.connection.RealConnection
import okhttp3.internal.connection.RealConnectionPool
import okhttp3.internal.connection.RealRoutePlanner
import okhttp3.internal.http.RealInterceptorChain
import okhttp3.internal.http.RecordingProxySelector
import okhttp3.tls.HandshakeCertificates
Expand Down Expand Up @@ -176,6 +177,14 @@ class TestValueFactory : Closeable {
.build()
}

fun newRoutePlanner(
client: OkHttpClient,
address: Address = newAddress(),
): RealRoutePlanner {
val call = RealCall(client, newRequest(address), forWebSocket = false)
return RealRoutePlanner(client, address, call, newChain(call))
}

override fun close() {
taskFaker.close()
}
Expand Down
Loading

0 comments on commit 699a212

Please sign in to comment.