public interface LogicalConnection extends OutgoingFrames, SuspendToken
Modifier and Type | Method and Description |
---|---|
void |
assertInputOpen()
Perform a quick check that the connection input is open.
|
void |
assertOutputOpen()
Perform a quick check that the connection output is open.
|
void |
close()
Send a websocket Close frame, without a status code or reason.
|
void |
close(int statusCode,
String reason)
Send a websocket Close frame, with status code.
|
void |
disconnect()
Terminate the connection (no close frame sent)
|
InetSocketAddress |
getLocalAddress()
Get the local
InetSocketAddress in use for this connection. |
WebSocketPolicy |
getPolicy()
The policy that the connection is running under.
|
InetSocketAddress |
getRemoteAddress()
Get the remote Address in use for this connection.
|
WebSocketSession |
getSession()
Get the Session for this connection
|
ConnectionState |
getState()
Get the WebSocket connection State.
|
boolean |
isInputClosed()
Test if input is closed (as a result of receiving a close frame)
|
boolean |
isOpen()
Simple test to see if connection is open (and not closed)
|
boolean |
isOutputClosed()
Test if output is closed (as a result of sending a close frame)
|
boolean |
isReading()
Tests if the connection is actively reading.
|
void |
onCloseHandshake(boolean incoming,
CloseInfo close)
A close handshake frame has been detected
|
void |
setNextIncomingFrames(IncomingFrames incoming)
Set where the connection should send the incoming frames to.
|
void |
setSession(WebSocketSession session)
Set the session associated with this connection
|
SuspendToken |
suspend()
Suspend a the incoming read events on the connection.
|
outgoingFrame
resume
void assertInputOpen() throws IOException
IOException
- if the connection input is closedvoid assertOutputOpen() throws IOException
IOException
- if the connection output is closedvoid close()
Basic usage: results in an non-blocking async write, then connection close.
StatusCode
,
close(int, String)
void close(int statusCode, String reason)
Advanced usage: results in an non-blocking async write, then connection close.
statusCode
- the status codereason
- the (optional) reason. (can be null for no reason)StatusCode
void disconnect()
InetSocketAddress getLocalAddress()
InetSocketAddress
in use for this connection.
Note: Non-physical connections, like during the Mux extensions, or during unit testing can result in a InetSocketAddress on port 0 and/or on localhost.
WebSocketPolicy getPolicy()
InetSocketAddress getRemoteAddress()
Note: Non-physical connections, like during the Mux extensions, or during unit testing can result in a InetSocketAddress on port 0 and/or on localhost.
WebSocketSession getSession()
ConnectionState getState()
boolean isInputClosed()
boolean isOpen()
boolean isOutputClosed()
boolean isReading()
void onCloseHandshake(boolean incoming, CloseInfo close)
incoming
- true if part of an incoming frame, false if part of an outgoing frame.close
- the close detailsvoid setNextIncomingFrames(IncomingFrames incoming)
Often this is from the Parser to the start of the extension stack, and eventually on to the session.
incoming
- the incoming frames handlervoid setSession(WebSocketSession session)
session
- the sessionSuspendToken suspend()
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.