Package org.apache.mina.proxy
Class AbstractProxyLogicHandler
- java.lang.Object
-
- org.apache.mina.proxy.AbstractProxyLogicHandler
-
- All Implemented Interfaces:
ProxyLogicHandler
- Direct Known Subclasses:
AbstractHttpLogicHandler,AbstractSocksLogicHandler
public abstract class AbstractProxyLogicHandler extends Object implements ProxyLogicHandler
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
- Author:
- Apache MINA Project
-
-
Constructor Summary
Constructors Constructor Description AbstractProxyLogicHandler(ProxyIoSession proxyIoSession)Creates a newAbstractProxyLogicHandler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 voidflushPendingWriteRequests()Send any write requests which were queued whilst waiting for handshaking to complete.protected ProxyFiltergetProxyFilter()ProxyIoSessiongetProxyIoSession()protected IoSessiongetSession()booleanisHandshakeComplete()Tests if handshake process is complete.protected voidsetHandshakeComplete()Signals that the handshake has finished.protected WriteFuturewriteData(IoFilter.NextFilter nextFilter, IoBuffer data)Writes data to the proxy server.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.mina.proxy.ProxyLogicHandler
doHandshake, messageReceived
-
-
-
-
Constructor Detail
-
AbstractProxyLogicHandler
public AbstractProxyLogicHandler(ProxyIoSession proxyIoSession)
Creates a newAbstractProxyLogicHandler.- Parameters:
proxyIoSession-ProxyIoSessionin use.
-
-
Method Detail
-
getProxyFilter
protected ProxyFilter getProxyFilter()
- Returns:
- the proxy filter
ProxyFilter.
-
getSession
protected IoSession getSession()
- Returns:
- the session.
-
getProxyIoSession
public ProxyIoSession getProxyIoSession()
- Specified by:
getProxyIoSessionin interfaceProxyLogicHandler- Returns:
- the
ProxyIoSessionobject.
-
writeData
protected WriteFuture writeData(IoFilter.NextFilter nextFilter, IoBuffer data)
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
protected void flushPendingWriteRequests() throws ExceptionSend any write requests which were queued whilst waiting for handshaking to complete.- Throws:
Exception- If we can't flush the pending write requests
-
enqueueWriteRequest
public void enqueueWriteRequest(IoFilter.NextFilter nextFilter, WriteRequest writeRequest)
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
protected void closeSession(String message, Throwable t)
Closes the session.- Parameters:
message- the error messaget- the exception which caused the session closing
-
closeSession
protected void closeSession(String message)
Closes the session.- Parameters:
message- the error message
-
-