|
47 | 47 | import java.io.IOException;
|
48 | 48 | import java.net.InetSocketAddress;
|
49 | 49 | import java.net.SocketAddress;
|
| 50 | +import java.util.Arrays; |
50 | 51 | import java.util.List;
|
51 | 52 |
|
52 | 53 | import static io.netty.handler.codec.http.HttpHeaderNames.EXPECT;
|
@@ -240,7 +241,7 @@ private <T> ListenableFuture<T> sendRequestWithOpenChannel(NettyResponseFuture<T
|
240 | 241 | SocketAddress channelRemoteAddress = channel.remoteAddress();
|
241 | 242 | if (channelRemoteAddress != null) {
|
242 | 243 | // otherwise, bad luck, the channel was closed, see bellow
|
243 |
| - scheduleRequestTimeout(future, (InetSocketAddress) channelRemoteAddress); |
| 244 | + scheduleRequestTimeout(future, channelRemoteAddress); |
244 | 245 | }
|
245 | 246 |
|
246 | 247 | future.setChannelState(ChannelState.POOLED);
|
@@ -400,12 +401,15 @@ private <T> Future<List<DomainSocketAddress>> resolveDomainAddresses(Request req
|
400 | 401 | if (proxy != null ) {
|
401 | 402 | throw new IllegalArgumentException("Unix domain socket not support proxy");
|
402 | 403 | } else {
|
403 |
| - |
404 | 404 | DomainSocketAddress socketAddress = new DomainSocketAddress(config.getUnixSocket());
|
405 | 405 | scheduleRequestTimeout(future, socketAddress);
|
406 |
| - |
407 |
| - if (request.getAddress() != null) { |
408 |
| - throw new IllegalArgumentException("Unix domain socket not support set address !"); |
| 406 | + SocketAddress address = request.getAddress(); |
| 407 | + if (address != null) { |
| 408 | + final Promise<List<DomainSocketAddress>> promise = ImmediateEventExecutor.INSTANCE.newPromise(); |
| 409 | + if (!(address instanceof DomainSocketAddress)){ |
| 410 | + throw new IllegalArgumentException("address must be instance of DomainSocketAddress"); |
| 411 | + } |
| 412 | + return promise.setSuccess(singletonList((DomainSocketAddress) address)); |
409 | 413 | } else {
|
410 | 414 | return RequestHostnameResolver.INSTANCE.resolve(request.getDomainNameResolver(), socketAddress, asyncHandler);
|
411 | 415 | }
|
|
0 commit comments