Skip to content

Commit 51ae5c2

Browse files
Revert per-instance HTTP transport in BrowserStackClient
Customers may rely on the previous JVM-wide static HTTP_TRANSPORT behaviour where setProxy on any client applied to all instances. Restoring the static field to avoid breaking those setups. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9a5d3d9 commit 51ae5c2

2 files changed

Lines changed: 4 additions & 67 deletions

File tree

src/main/java/com/browserstack/client/BrowserStackClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public Object parseAndClose(Reader reader, Type type) throws IOException {
6969
throw new IOException("Unsupported operation");
7070
}
7171
};
72-
private HttpTransport httpTransport = new ApacheHttpTransport();
72+
private static HttpTransport HTTP_TRANSPORT = new ApacheHttpTransport();
7373
protected final BrowserStackCache<String, Object> cacheMap;
7474

7575
private HttpRequestFactory requestFactory;
@@ -105,8 +105,8 @@ public BrowserStackClient(String baseUrl, String username, String accessKey) {
105105
this.accessKey = accessKey.trim();
106106
}
107107

108-
HttpRequestFactory newRequestFactory() {
109-
return httpTransport.createRequestFactory(httpRequest -> httpRequest.setParser(OBJECT_PARSER));
108+
static HttpRequestFactory newRequestFactory() {
109+
return HTTP_TRANSPORT.createRequestFactory(httpRequest -> httpRequest.setParser(OBJECT_PARSER));
110110
}
111111

112112
static HttpRequest newRequest(final HttpRequestFactory requestFactory, final Method method, final GenericUrl url) throws BrowserStackException {
@@ -174,7 +174,7 @@ public void setProxy(final String proxyHost, final int proxyPort, final String p
174174
}
175175

176176
final HttpClient client = clientBuilder.build();
177-
this.httpTransport = new ApacheHttpTransport(client);
177+
HTTP_TRANSPORT = new ApacheHttpTransport(client);
178178
this.requestFactory = newRequestFactory();
179179
}
180180

src/test/java/com/browserstack/client/BrowserStackClientProxyIsolationTest.java

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)