Class AbstractProxyLogicHandler
java.lang.Object
org.apache.mina.proxy.AbstractProxyLogicHandler
- All Implemented Interfaces:
ProxyLogicHandler
- Direct Known Subclasses:
AbstractHttpLogicHandler, AbstractSocksLogicHandler
AbstractProxyLogicHandler.java - Helper class to handle proxy handshaking logic. Derived classes
implement proxy type specific logic.
Based upon SSLHandler from mina-filter-ssl.
- Since:
- MINA 2.0.0-M3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classEvent wrapper class for enqueued events. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanHas the handshake been completed.private static final org.slf4j.Loggerprivate ProxyIoSessionObject that contains all the proxy authentication session informations.private Queue<AbstractProxyLogicHandler.Event> Queue of write events which occurred before the proxy handshake had completed. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractProxyLogicHandler(ProxyIoSession proxyIoSession) Creates a newAbstractProxyLogicHandler. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcloseSession(String message) Closes the session.protected voidcloseSession(String message, Throwable t) Closes the session.voidenqueueWriteRequest(IoFilter.NextFilter nextFilter, WriteRequest writeRequest) Enqueue a message to be written once handshaking is complete.protected voidSend any write requests which were queued whilst waiting for handshaking to complete.protected ProxyFilterprotected IoSessionbooleanTests if handshake process is complete.protected final voidSignals that the handshake has finished.protected WriteFuturewriteData(IoFilter.NextFilter nextFilter, IoBuffer data) Writes data to the proxy server.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ProxyLogicHandler
doHandshake, messageReceived
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
proxyIoSession
Object that contains all the proxy authentication session informations. -
writeRequestQueue
Queue of write events which occurred before the proxy handshake had completed. -
handshakeComplete
private boolean handshakeCompleteHas the handshake been completed.
-
-
Constructor Details
-
AbstractProxyLogicHandler
Creates a newAbstractProxyLogicHandler.- Parameters:
proxyIoSession-ProxyIoSessionin use.
-
-
Method Details
-
getProxyFilter
- Returns:
- the proxy filter
ProxyFilter.
-
getSession
- Returns:
- the session.
-
getProxyIoSession
- Specified by:
getProxyIoSessionin interfaceProxyLogicHandler- Returns:
- the
ProxyIoSessionobject.
-
writeData
Writes data to the proxy server.- Parameters:
nextFilter- the next filterdata- Data buffer to be written.- Returns:
- A Future for the write operation
-
isHandshakeComplete
public boolean isHandshakeComplete()Description copied from interface:ProxyLogicHandlerTests if handshake process is complete.- Specified by:
isHandshakeCompletein interfaceProxyLogicHandler- Returns:
trueif handshaking is complete and data can be sent through the proxy.
-
setHandshakeComplete
protected final void setHandshakeComplete()Signals that the handshake has finished. -
flushPendingWriteRequests
-
enqueueWriteRequest
Enqueue a message to be written once handshaking is complete.- Specified by:
enqueueWriteRequestin interfaceProxyLogicHandler- Parameters:
nextFilter- the next filter in filter chainwriteRequest- the data to be written
-
closeSession
-
closeSession
Closes the session.- Parameters:
message- the error message
-