Package org.littleshoot.proxy.impl
Class ConnectionFlowStep
- java.lang.Object
-
- org.littleshoot.proxy.impl.ConnectionFlowStep
-
abstract class ConnectionFlowStep extends Object
Represents a phase in aConnectionFlow.
-
-
Field Summary
Fields Modifier and Type Field Description private ProxyConnectionconnectionprivate ProxyConnectionLoggerLOGprivate ConnectionStatestate
-
Constructor Summary
Constructors Constructor Description ConnectionFlowStep(ProxyConnection connection, ConnectionState state)Construct a new step in a connection flow.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Futureexecute()Implement this method to actually do the work involved in this step of the flow.(package private) ProxyConnectiongetConnection()(package private) ConnectionStategetState()(package private) voidonSuccess(ConnectionFlow flow)When the flow determines that this step was successful, it calls into this method.(package private) voidread(ConnectionFlow flow, Object msg)Any messages that are read from the underlying connection while we're at this step of the connection flow are passed to this method.(package private) booleanshouldExecuteOnEventLoop()Indicates whether or not this step should be executed on the channel's event loop.(package private) booleanshouldSuppressInitialRequest()Indicates whether or not to suppress the initial request.StringtoString()
-
-
-
Field Detail
-
LOG
private final ProxyConnectionLogger LOG
-
connection
private final ProxyConnection connection
-
state
private final ConnectionState state
-
-
Constructor Detail
-
ConnectionFlowStep
ConnectionFlowStep(ProxyConnection connection, ConnectionState state)
Construct a new step in a connection flow.- Parameters:
connection- the connection that we're working onstate- the state that the connection will show while we're processing this step
-
-
Method Detail
-
getConnection
ProxyConnection getConnection()
-
getState
ConnectionState getState()
-
shouldSuppressInitialRequest
boolean shouldSuppressInitialRequest()
Indicates whether or not to suppress the initial request. Defaults to false, can be overridden.
-
shouldExecuteOnEventLoop
boolean shouldExecuteOnEventLoop()
Indicates whether or not this step should be executed on the channel's event loop. Defaults to true, can be overridden.
If this step modifies the pipeline, for example by adding/removing handlers, it's best to make it execute on the event loop.
-
execute
protected abstract Future execute()
Implement this method to actually do the work involved in this step of the flow.
-
onSuccess
void onSuccess(ConnectionFlow flow)
When the flow determines that this step was successful, it calls into this method. The default implementation simply continues with the flow. Other implementations may choose to not continue and instead wait for a message or something like that.
-
read
void read(ConnectionFlow flow, Object msg)
Any messages that are read from the underlying connection while we're at this step of the connection flow are passed to this method.
The default implementation ignores the message and logs this, since we weren't really expecting a message here.
Some
ConnectionFlowSteps do need to read the messages, so they override this method as appropriate.- Parameters:
flow- ourConnectionFlowmsg- the message read from the underlying connection
-
-