Skip to content

Completely fake out TLS for testing - #9640

Merged
swankjesse merged 5 commits into
mainfrom
jwilson.0807.fake_tls
Aug 9, 2026
Merged

Completely fake out TLS for testing#9640
swankjesse merged 5 commits into
mainfrom
jwilson.0807.fake_tls

Conversation

@swankjesse

Copy link
Copy Markdown
Collaborator

This covers the happy path of OkHttp + MockWebServer with HTTPS.

This doesn't actually perform anything cryptographic; certificates and protocols and things are transmitted in-memory rather than over the wire.

This replaces the Okio.inMemorySocketPair() after the fake TLS handshake; that way there's no risk of data leaking from the pre-encrypted session to the post-encrypted session.

The useful capability this unlocks is testing TLS scenarios like ECH retries, before we have a server-side TLS stack that can support them.

This covers the happy path of OkHttp + MockWebServer with HTTPS.

This doesn't actually perform anything cryptographic; certificates
and protocols and things are transmitted in-memory rather than
over the wire.

This replaces the Okio.inMemorySocketPair() after the fake
TLS handshake; that way there's no risk of data leaking from
the pre-encrypted session to the post-encrypted session.

The useful capability this unlocks is testing TLS scenarios
like ECH retries, before we have a server-side TLS stack that
can support them.

val (clientSocket, serverSocket) = inMemorySocketPair(maxBufferSize = 1024 * 1024)

return Handshaker.Result(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun to see. I still hope we can kick over Tls Socket code to those suckers who work on okio. :)

This could be a nice fake over there.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your SocketAdapter abstraction is really the thing we need around these parts. A good enough SocketAdapter API might make it so we can confirm Conscrypt conforms to our Socket expectations, without actually running all the tests against it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(And similarly for all other TLS things)

@swankjesse
swankjesse merged commit a82269b into main Aug 9, 2026
24 of 26 checks passed
@swankjesse
swankjesse deleted the jwilson.0807.fake_tls branch August 9, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants