Package org.elasticsearch.transport
Class MockTcpTransport
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractLifecycleComponent
-
- org.elasticsearch.transport.TcpTransport
-
- org.elasticsearch.transport.MockTcpTransport
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,LifecycleComponent,Releasable,Transport
public class MockTcpTransport extends TcpTransport
This is a socket based blocking TcpTransport implementation that is used for tests that need real networking. This implementation is a test only implementation that implements the networking layer in the worst possible way since it blocks and uses a thread per request model.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classMockTcpTransport.MockChannel-
Nested classes/interfaces inherited from class org.elasticsearch.transport.TcpTransport
TcpTransport.HttpOnTransportException, TcpTransport.NodeChannels, TcpTransport.ProfileSettings
-
Nested classes/interfaces inherited from interface org.elasticsearch.transport.Transport
Transport.Connection, Transport.ResponseContext<T extends TransportResponse>, Transport.ResponseHandlers
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.transport.TcpTransport
bigArrays, networkService, pageCacheRecycler, profileSettings, settings, threadPool, TRANSPORT_WORKER_THREAD_NAME_PREFIX
-
Fields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle
-
-
Constructor Summary
Constructors Constructor Description MockTcpTransport(Settings settings, ThreadPool threadPool, BigArrays bigArrays, CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService)MockTcpTransport(Settings settings, ThreadPool threadPool, BigArrays bigArrays, CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService, Version mockVersion)
-
Method Summary
Modifier and Type Method Description protected MockTcpTransport.MockChannelbind(java.lang.String name, java.net.InetSocketAddress address)protected voiddoStart()protected MockTcpTransport.MockChannelinitiateChannel(DiscoveryNode node)protected ConnectionProfilemaybeOverrideConnectionProfile(ConnectionProfile connectionProfile)protected voidstopInternal()-
Methods inherited from class org.elasticsearch.transport.TcpTransport
addMessageListener, addressesFromString, bindServer, boundAddress, consumeNetworkReads, doClose, doStop, ensureOpen, executeHandshake, getInFlightRequestBreaker, getLocalAddresses, getProfileSettings, getRequestHandler, getResponseHandlers, getStats, handleRequest, inboundMessage, messageReceived, onException, onNonChannelException, onServerException, openConnection, profileBoundAddresses, readMessageLength, registerRequestHandler, removeMessageListener, sendErrorResponse, sendResponse, serverAcceptedChannel, validateRequest
-
Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.component.LifecycleComponent
addLifecycleListener, lifecycleState, removeLifecycleListener, start, stop
-
Methods inherited from interface org.elasticsearch.common.lease.Releasable
close
-
-
-
-
Constructor Detail
-
MockTcpTransport
public MockTcpTransport(Settings settings, ThreadPool threadPool, BigArrays bigArrays, CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService)
-
MockTcpTransport
public MockTcpTransport(Settings settings, ThreadPool threadPool, BigArrays bigArrays, CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService, Version mockVersion)
-
-
Method Detail
-
bind
protected MockTcpTransport.MockChannel bind(java.lang.String name, java.net.InetSocketAddress address) throws java.io.IOException
- Specified by:
bindin classTcpTransport- Throws:
java.io.IOException
-
initiateChannel
protected MockTcpTransport.MockChannel initiateChannel(DiscoveryNode node) throws java.io.IOException
- Specified by:
initiateChannelin classTcpTransport- Throws:
java.io.IOException
-
maybeOverrideConnectionProfile
protected ConnectionProfile maybeOverrideConnectionProfile(ConnectionProfile connectionProfile)
- Overrides:
maybeOverrideConnectionProfilein classTcpTransport
-
doStart
protected void doStart()
- Overrides:
doStartin classTcpTransport
-
stopInternal
protected void stopInternal()
- Specified by:
stopInternalin classTcpTransport
-
-