4545
4646public class HttpCommandExecutor implements CommandExecutor , NeedsLocalLogs {
4747
48- private static final HttpClient .Factory defaultClientFactory = HttpClient .Factory .createDefault ();
49-
5048 private final URL remoteServer ;
5149 private final HttpClient client ;
5250 private final HttpClient .Factory httpClientFactory ;
@@ -56,14 +54,22 @@ public class HttpCommandExecutor implements CommandExecutor, NeedsLocalLogs {
5654
5755 private LocalLogs logs = LocalLogs .getNullLogger ();
5856
57+ private static class DefaultClientFactoryHolder {
58+ static HttpClient .Factory defaultClientFactory = HttpClient .Factory .createDefault ();
59+ }
60+
61+ public static HttpClient .Factory getDefaultClientFactory () {
62+ return DefaultClientFactoryHolder .defaultClientFactory ;
63+ }
64+
5965 public HttpCommandExecutor (URL addressOfRemoteServer ) {
6066 this (emptyMap (), Require .nonNull ("Server URL" , addressOfRemoteServer ));
6167 }
6268
6369 public HttpCommandExecutor (ClientConfig config ) {
6470 this (emptyMap (),
65- Require .nonNull ("HTTP client configuration" , config ),
66- defaultClientFactory );
71+ Require .nonNull ("HTTP client configuration" , config ),
72+ getDefaultClientFactory () );
6773 }
6874
6975 /**
@@ -78,8 +84,8 @@ public HttpCommandExecutor(
7884 URL addressOfRemoteServer )
7985 {
8086 this (Require .nonNull ("Additional commands" , additionalCommands ),
81- Require .nonNull ("Server URL" , addressOfRemoteServer ),
82- defaultClientFactory );
87+ Require .nonNull ("Server URL" , addressOfRemoteServer ),
88+ getDefaultClientFactory () );
8389 }
8490
8591 public HttpCommandExecutor (
0 commit comments