java.io.Closeable, java.lang.AutoCloseable, LifecycleComponent, Releasable, Transportpublic class CapturingTransport extends java.lang.Object implements Transport
| Modifier and Type | Class | Description |
|---|---|---|
static class |
CapturingTransport.CapturedRequest |
Transport.ConnectionTRANSPORT_TCP_COMPRESS| Constructor | Description |
|---|---|
CapturingTransport() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addLifecycleListener(LifecycleListener listener) |
|
TransportAddress[] |
addressesFromString(java.lang.String address,
int perAddressLimit) |
|
BoundTransportAddress |
boundAddress() |
|
CapturingTransport.CapturedRequest[] |
capturedRequests() |
returns all requests captured so far.
|
java.util.Map<java.lang.String,java.util.List<CapturingTransport.CapturedRequest>> |
capturedRequestsByTargetNode() |
returns all requests captured so far, grouped by target node.
|
void |
clear() |
clears captured requests
|
void |
close() |
|
void |
connectToNode(DiscoveryNode node,
ConnectionProfile connectionProfile,
CheckedBiConsumer<Transport.Connection,ConnectionProfile,java.io.IOException> connectionValidator) |
|
void |
disconnectFromNode(DiscoveryNode node) |
|
CapturingTransport.CapturedRequest[] |
getCapturedRequestsAndClear() |
Returns all requests captured so far.
|
java.util.Map<java.lang.String,java.util.List<CapturingTransport.CapturedRequest>> |
getCapturedRequestsByTargetNodeAndClear() |
Returns all requests captured so far, grouped by target node.
|
Transport.Connection |
getConnection(DiscoveryNode node) |
|
java.util.List<java.lang.String> |
getLocalAddresses() |
|
TransportStats |
getStats() |
|
void |
handleError(long requestId,
TransportException e) |
simulate an error for the given requestId, unlike
handleLocalError(long, Throwable) and
handleRemoteError(long, Throwable), the provided
exception will not be wrapped but will be delivered to the
transport layer as is |
void |
handleLocalError(long requestId,
java.lang.Throwable t) |
simulate a local error for the given requestId, will be wrapped
by a
SendRequestTransportException |
void |
handleRemoteError(long requestId,
java.lang.Throwable t) |
simulate a remote error for the given requestId, will be wrapped
by a
RemoteTransportException |
void |
handleResponse(long requestId,
TransportResponse response) |
simulate a response for the given requestId
|
Lifecycle.State |
lifecycleState() |
|
long |
newRequestId() |
|
boolean |
nodeConnected(DiscoveryNode node) |
|
Transport.Connection |
openConnection(DiscoveryNode node,
ConnectionProfile profile) |
|
java.util.Map<java.lang.String,BoundTransportAddress> |
profileBoundAddresses() |
|
void |
removeLifecycleListener(LifecycleListener listener) |
|
void |
setTransportService(TransportService transportService) |
|
void |
start() |
|
void |
stop() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetInFlightRequestBreakerpublic CapturingTransport.CapturedRequest[] capturedRequests()
clear()public CapturingTransport.CapturedRequest[] getCapturedRequestsAndClear()
capturedRequests().public java.util.Map<java.lang.String,java.util.List<CapturingTransport.CapturedRequest>> capturedRequestsByTargetNode()
clear()public java.util.Map<java.lang.String,java.util.List<CapturingTransport.CapturedRequest>> getCapturedRequestsByTargetNodeAndClear()
capturedRequestsByTargetNode().public void clear()
public void handleResponse(long requestId,
TransportResponse response)
public void handleLocalError(long requestId,
java.lang.Throwable t)
SendRequestTransportExceptionrequestId - the id corresponding to the captured send
requestt - the failure to wrappublic void handleRemoteError(long requestId,
java.lang.Throwable t)
RemoteTransportExceptionrequestId - the id corresponding to the captured send
requestt - the failure to wrappublic void handleError(long requestId,
TransportException e)
handleLocalError(long, Throwable) and
handleRemoteError(long, Throwable), the provided
exception will not be wrapped but will be delivered to the
transport layer as isrequestId - the id corresponding to the captured send
requeste - the failurepublic Transport.Connection openConnection(DiscoveryNode node, ConnectionProfile profile) throws java.io.IOException
openConnection in interface Transportjava.io.IOExceptionpublic TransportStats getStats()
public void setTransportService(TransportService transportService)
setTransportService in interface Transportpublic BoundTransportAddress boundAddress()
boundAddress in interface Transportpublic java.util.Map<java.lang.String,BoundTransportAddress> profileBoundAddresses()
profileBoundAddresses in interface Transportpublic TransportAddress[] addressesFromString(java.lang.String address, int perAddressLimit) throws java.net.UnknownHostException
addressesFromString in interface Transportjava.net.UnknownHostExceptionpublic boolean nodeConnected(DiscoveryNode node)
nodeConnected in interface Transportpublic void connectToNode(DiscoveryNode node, ConnectionProfile connectionProfile, CheckedBiConsumer<Transport.Connection,ConnectionProfile,java.io.IOException> connectionValidator) throws ConnectTransportException
connectToNode in interface TransportConnectTransportExceptionpublic void disconnectFromNode(DiscoveryNode node)
disconnectFromNode in interface Transportpublic Lifecycle.State lifecycleState()
lifecycleState in interface LifecycleComponentpublic void addLifecycleListener(LifecycleListener listener)
addLifecycleListener in interface LifecycleComponentpublic void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener in interface LifecycleComponentpublic void start()
start in interface LifecycleComponentpublic void stop()
stop in interface LifecycleComponentpublic void close()
close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in interface Releasablepublic java.util.List<java.lang.String> getLocalAddresses()
getLocalAddresses in interface Transportpublic long newRequestId()
newRequestId in interface Transportpublic Transport.Connection getConnection(DiscoveryNode node)
getConnection in interface Transport