Merge pull request #19306 from javanna/fix/default_sniffer_scheme
Rest Client: HostsSniffer to set http as default scheme
This commit is contained in:
commit
64880ca4ed
|
@ -156,7 +156,7 @@ public class HostsSniffer {
|
|||
|
||||
private final RestClient restClient;
|
||||
private long sniffRequestTimeoutMillis = DEFAULT_SNIFF_REQUEST_TIMEOUT;
|
||||
private Scheme scheme;
|
||||
private Scheme scheme = Scheme.HTTP;
|
||||
|
||||
private Builder(RestClient restClient) {
|
||||
Objects.requireNonNull(restClient, "restClient cannot be null");
|
||||
|
|
|
@ -89,7 +89,11 @@ public class HostsSnifferTests extends RestClientTestCase {
|
|||
public void testSniffNodes() throws IOException, URISyntaxException {
|
||||
HttpHost httpHost = new HttpHost(httpServer.getAddress().getHostString(), httpServer.getAddress().getPort());
|
||||
try (RestClient restClient = RestClient.builder(httpHost).build()) {
|
||||
HostsSniffer sniffer = new HostsSniffer(restClient, sniffRequestTimeout, scheme);
|
||||
HostsSniffer.Builder builder = HostsSniffer.builder(restClient).setSniffRequestTimeoutMillis(sniffRequestTimeout);
|
||||
if (scheme != HostsSniffer.Scheme.HTTP || randomBoolean()) {
|
||||
builder.setScheme(scheme);
|
||||
}
|
||||
HostsSniffer sniffer = builder.build();
|
||||
try {
|
||||
List<HttpHost> sniffedHosts = sniffer.sniffHosts();
|
||||
if (sniffResponse.isFailure) {
|
||||
|
|
Loading…
Reference in New Issue