|
24 | 24 | import org.elasticsearch.cloud.aws.AwsEc2Service; |
25 | 25 | import org.elasticsearch.cloud.aws.AwsEc2Service.DISCOVERY_EC2; |
26 | 26 | import org.elasticsearch.cluster.node.DiscoveryNode; |
| 27 | +import org.elasticsearch.common.io.stream.NamedWriteableRegistry; |
| 28 | +import org.elasticsearch.common.network.NetworkService; |
27 | 29 | import org.elasticsearch.common.settings.Settings; |
28 | 30 | import org.elasticsearch.common.transport.LocalTransportAddress; |
29 | 31 | import org.elasticsearch.common.transport.TransportAddress; |
| 32 | +import org.elasticsearch.common.util.BigArrays; |
| 33 | +import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; |
30 | 34 | import org.elasticsearch.test.ESTestCase; |
31 | 35 | import org.elasticsearch.test.transport.MockTransportService; |
32 | 36 | import org.elasticsearch.threadpool.TestThreadPool; |
33 | 37 | import org.elasticsearch.threadpool.ThreadPool; |
| 38 | +import org.elasticsearch.transport.MockTcpTransport; |
| 39 | +import org.elasticsearch.transport.Transport; |
34 | 40 | import org.elasticsearch.transport.TransportService; |
35 | 41 | import org.junit.AfterClass; |
36 | 42 | import org.junit.Before; |
37 | 43 | import org.junit.BeforeClass; |
38 | 44 |
|
39 | 45 | import java.util.ArrayList; |
| 46 | +import java.util.Collections; |
40 | 47 | import java.util.List; |
41 | 48 |
|
42 | 49 | import static org.hamcrest.Matchers.containsString; |
@@ -66,7 +73,17 @@ public static void stopThreadPool() throws InterruptedException { |
66 | 73 |
|
67 | 74 | @Before |
68 | 75 | public void createTransportService() { |
69 | | - transportService = MockTransportService.createNewService(Settings.EMPTY, Version.CURRENT, threadPool); |
| 76 | + NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(Collections.emptyList()); |
| 77 | + final Transport transport = new MockTcpTransport(Settings.EMPTY, threadPool, BigArrays.NON_RECYCLING_INSTANCE, |
| 78 | + new NoneCircuitBreakerService(), namedWriteableRegistry, new NetworkService(Settings.EMPTY, Collections.emptyList()), |
| 79 | + Version.CURRENT) { |
| 80 | + @Override |
| 81 | + public TransportAddress[] addressesFromString(String address, int perAddressLimit) throws Exception { |
| 82 | + // we just need to ensure we don't resolve DNS here |
| 83 | + return new TransportAddress[] {new LocalTransportAddress(address)}; |
| 84 | + } |
| 85 | + }; |
| 86 | + transportService = new MockTransportService(Settings.EMPTY, transport, threadPool, TransportService.NOOP_TRANSPORT_INTERCEPTOR); |
70 | 87 | } |
71 | 88 |
|
72 | 89 | protected List<DiscoveryNode> buildDynamicNodes(Settings nodeSettings, int nodes) { |
|
0 commit comments