Replace magic test port 12110 with 0 (#345)

Also introduce constants for some test package SHAs
to make them easier to update.
This commit is contained in:
translatenix
2024-03-20 10:47:28 -07:00
committed by GitHub
parent 2aa60eaf1f
commit dfe85b786e
123 changed files with 469 additions and 469 deletions
@@ -111,8 +111,8 @@ public interface HttpClient extends AutoCloseable {
/**
* Sets a test server's listening port.
*
* <p>If set, requests that specify port 12110 will be modified to use the given port. This is
* an internal test option.
* <p>If set, requests that specify port 0 will be modified to use the given port. This is an
* internal test option.
*/
Builder setTestPort(int port);
@@ -105,9 +105,7 @@ final class RequestRewritingClient implements HttpClient {
}
private URI rewriteUri(URI uri) {
// Would be nice to use port 0 instead of 12110,
// but this is best done in a separate commit.
if (testPort != -1 && uri.getPort() == 12110) {
if (testPort != -1 && uri.getPort() == 0) {
return HttpUtils.setPort(uri, testPort);
}
return uri;