|
|
|
@ -108,12 +108,17 @@ public final class Chords extends ListenerAdapter |
|
|
|
|
|
|
|
|
|
if (settings.getLocalAddr() != null) |
|
|
|
|
{ |
|
|
|
|
final WebSocketFactory webSocketFactory = new WebSocketFactory(); |
|
|
|
|
// make local binding socket factory
|
|
|
|
|
final LocalBindSocketFactory localBindSocketFactory = new LocalBindSocketFactory(); |
|
|
|
|
localBindSocketFactory.setLocalAddress(InetAddress.getByName(settings.getLocalAddr())); |
|
|
|
|
|
|
|
|
|
// install local socket factory for HTTP
|
|
|
|
|
OkHttpClient.Builder httpBuilder = IOUtil.newHttpClientBuilder(); |
|
|
|
|
httpBuilder.socketFactory(localBindSocketFactory); |
|
|
|
|
builder.setHttpClientBuilder(httpBuilder); |
|
|
|
|
|
|
|
|
|
localBindSocketFactory.setLocalAddress(InetAddress.getByName(settings.getLocalAddr())); |
|
|
|
|
// install local socket factory for websockets
|
|
|
|
|
final WebSocketFactory webSocketFactory = new WebSocketFactory(); |
|
|
|
|
webSocketFactory.setSocketFactory(localBindSocketFactory); |
|
|
|
|
builder.setWebsocketFactory(webSocketFactory); |
|
|
|
|
} |
|
|
|
|