Merge pull request #526 from jbonofre/AMQ-7476

[AMQ-7476] Add http schema in the HTTP registry
This commit is contained in:
Jean-Baptiste Onofré 2020-05-06 07:54:04 +02:00 committed by GitHub
commit b01406b655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder; import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.HttpClientConnectionManager; import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.DefaultHostnameVerifier; import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.apache.http.conn.ssl.NoopHostnameVerifier; import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
@ -61,6 +62,7 @@ public class HttpsClientTransport extends HttpClientTransport {
HostnameVerifier hostnameVerifier = verifyHostName ? new DefaultHostnameVerifier() : new NoopHostnameVerifier(); HostnameVerifier hostnameVerifier = verifyHostName ? new DefaultHostnameVerifier() : new NoopHostnameVerifier();
SSLConnectionSocketFactory sslConnectionFactory = new SSLConnectionSocketFactory(sslSocketFactory, hostnameVerifier); SSLConnectionSocketFactory sslConnectionFactory = new SSLConnectionSocketFactory(sslSocketFactory, hostnameVerifier);
registryBuilder.register("https", sslConnectionFactory); registryBuilder.register("https", sslConnectionFactory);
registryBuilder.register("http", PlainConnectionSocketFactory.INSTANCE);
return registryBuilder.build(); return registryBuilder.build();
} catch (Exception e) { } catch (Exception e) {
throw new IllegalStateException("Failure trying to create scheme registry", e); throw new IllegalStateException("Failure trying to create scheme registry", e);