-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
okhttp: Pass TransportFactory directly to transport constructor
This greatly reduces the number of arguments passed to the constructor and allows using the builder in tests to change specific arguments without having to pass all the other arguments. It also makes it easier to see where tests are doing something special. While it is weird to expose fields as package-private for digging-into in the constructor, it's actually very similar to the pattern of passing the builder instance into the constuctor. In this case, the weirdness is because the builder isn't a nested class of the transport and there is an additional level of building going on (Builder and TransportFactory). We do this pattern already in ManagedChannelImpl which only has the one level of building.
- Loading branch information
Showing
3 changed files
with
70 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.