public class MockTransport extends DefaultTransportListener implements Transport
Modifier and Type | Field and Description |
---|---|
protected Transport |
next |
protected TransportListener |
transportListener |
Constructor and Description |
---|
MockTransport(Transport next) |
Modifier and Type | Method and Description |
---|---|
FutureResponse |
asyncRequest(Object command,
ResponseCallback responseCallback)
An asynchronous request response where the Receipt will be returned in
the future.
|
Transport |
getNext() |
int |
getReceiveCounter()
Returns a counter which gets incremented as data is read from the transport.
|
String |
getRemoteAddress() |
TransportListener |
getTransportListener()
Returns the current transport listener
|
void |
install(TransportFilter filter) |
boolean |
isConnected() |
boolean |
isDisposed() |
boolean |
isFaultTolerant()
Indicates if the transport can handle faults
|
boolean |
isReconnectSupported() |
boolean |
isUpdateURIsSupported() |
<T> T |
narrow(Class<T> target) |
void |
onCommand(Object command)
called to process a command
|
void |
oneway(Object command)
A one way asynchronous send
|
void |
onException(IOException error)
An unrecoverable exception has occured on the transport
|
void |
reconnect(URI uri)
reconnect to another location
|
Object |
request(Object command)
A synchronous request response
|
Object |
request(Object command,
int timeout)
A synchronous request response
|
void |
setNext(Transport next) |
void |
setTransportListener(TransportListener channelListener)
Registers an inbound command listener
|
void |
start() |
void |
stop() |
String |
toString() |
void |
updateURIs(boolean reblance,
URI[] uris)
Provide a list of available alternative locations
|
transportInterupted, transportResumed
protected TransportListener transportListener
public MockTransport(Transport next)
public void setTransportListener(TransportListener channelListener)
Transport
setTransportListener
in interface Transport
public void start() throws Exception
start
in interface Service
IOException
- if the next channel has not been set.Exception
Service.start()
public void stop() throws Exception
stop
in interface Service
Exception
Service.stop()
public void onCommand(Object command)
DefaultTransportListener
onCommand
in interface TransportListener
onCommand
in class DefaultTransportListener
public TransportListener getTransportListener()
Transport
getTransportListener
in interface Transport
public void oneway(Object command) throws IOException
Transport
oneway
in interface Transport
IOException
public FutureResponse asyncRequest(Object command, ResponseCallback responseCallback) throws IOException
Transport
asyncRequest
in interface Transport
responseCallback
- TODOIOException
public Object request(Object command) throws IOException
Transport
request
in interface Transport
IOException
public Object request(Object command, int timeout) throws IOException
Transport
request
in interface Transport
IOException
public void onException(IOException error)
DefaultTransportListener
onException
in interface TransportListener
onException
in class DefaultTransportListener
public void install(TransportFilter filter)
public String getRemoteAddress()
getRemoteAddress
in interface Transport
public boolean isFaultTolerant()
Transport
isFaultTolerant
in interface Transport
Transport.isFaultTolerant()
public boolean isDisposed()
isDisposed
in interface Transport
public boolean isConnected()
isConnected
in interface Transport
public void reconnect(URI uri) throws IOException
Transport
reconnect
in interface Transport
IOException
- on failure of if not supportedpublic int getReceiveCounter()
Transport
getReceiveCounter
in interface Transport
public boolean isReconnectSupported()
isReconnectSupported
in interface Transport
public boolean isUpdateURIsSupported()
isUpdateURIsSupported
in interface Transport
public void updateURIs(boolean reblance, URI[] uris) throws IOException
Transport
updateURIs
in interface Transport
IOException
Copyright © 2005–2016 FuseSource, Corp.. All rights reserved.