|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
protected static interface ClientChannel.ClientHandshakeStep
Interface representing client side step of a protocol handshake procedure.
Client handshake procedure is handled in a state machine way, where "state" is an instance ofClientHandshakeStep
.EventProtocolVersion
response.EventClientRegistered
.ClientChannel.onOpen()
, where creates and sets
(ClientChannel.setHandshakePhase(ClientHandshakeStep)
) the initial step/state.
@Override
protected void onReceiveMessage(final Message msg) {
if (handshakeState != null) {
handshakeState = handshakeState.handleMessage(msg);
if (handshakeState == null) {
// handshake successfully finished
finalyzeHandshake(); // switch channel from 'Opening' to 'Opened'
}
}
...
}
ClientChannel.BasicClientHandshakeStep
,
ClientChannel.setHandshakePhase(ClientHandshakeStep)
,
ClientChannel.onOpen()
Method Summary | |
---|---|
Message |
getRegistrationRequest()
This method is intended to be used from initState() to get
a new instance of handshake request message. |
ClientChannel.ClientHandshakeStep |
handleMessage(Message event)
This method handles incoming message assuming it is a server response for the request by initState() .It is responsible for the following operations: Check that the incoming message is a "successful" response to the request, extract store useful information like session id, server version, etc. If the message is an error message, it should throw appropriate exception. If the message is some acceptable unsolicited event, it may be passed through to user code. It returns null if handshake is successfully finished.
It returns "self" reference to handle next incoming message with this state.
It returns something like (new NextStep()).initState()
to successfully pass this step and to switch to the next one. |
ClientChannel.ClientHandshakeStep |
initState()
General goal of this method is to send the request message and get ready to handle server response with handleMessage(Message) . |
Method Detail |
---|
ClientChannel.ClientHandshakeStep initState() throws ProtocolException
handleMessage(Message)
.
Several variations of a handshake step:null
in case of
handshake finish, or "recursively" returns something like
(new NextStep()).initState()
if this step is not the last one.(new NextStep()).initState()
if this step is not the last one.getRegistrationRequest()
.
null
if there is no need to wait for any server response
(handshake successfully finished).
ProtocolException
- in case of problem on send of the request message.getRegistrationRequest()
,
handleMessage(Message)
Message getRegistrationRequest() throws ProtocolException
initState()
to get
a new instance of handshake request message.
ProtocolException
ClientChannel.ClientHandshakeStep handleMessage(Message event) throws ProtocolException
initState()
.null
if handshake is successfully finished.(new NextStep()).initState()
to successfully pass this step and to switch to the next one.
event
- incoming message from the server side.
ProtocolException
- in case of handshake error
or in case of problem on send of next request message.
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |