Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@
import io.reactivex.netty.protocol.http.client.HttpClientResponse;
import io.reactivex.netty.servo.http.HttpClientListener;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand All @@ -48,7 +52,10 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import javax.net.ssl.SNIHostName;
import javax.net.ssl.SNIServerName;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLParameters;

import rx.Observable;
import rx.functions.Func1;
Expand Down Expand Up @@ -511,6 +518,23 @@ protected HttpClient<I, O> createRxClient(Server server) {
@Override
public SSLEngine createSSLEngine(ByteBufAllocator allocator) {
SSLEngine myEngine = super.createSSLEngine(allocator);

URL url = null;
if(null!=getRxClients()) {
try {
Server server = getRxClients().entrySet().iterator().next().getKey();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some dough that is correct to get only the first one

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gather all hosts

url = new URL(server.getScheme() + "://" + server.getHost());

SSLParameters sslParameters = new SSLParameters();
List<SNIServerName> sniServerNames = new ArrayList<>();
sniServerNames.add(new SNIHostName(url.getHost()));
sslParameters.setServerNames(sniServerNames);
myEngine.setSSLParameters(sslParameters);
} catch (MalformedURLException e) {
e.printStackTrace();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a logger

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added logger

}
}

myEngine.setUseClientMode(true);
return myEngine;
}
Expand Down