com.caucho.network.listen
Class AbstractSocketLink

java.lang.Object
  extended by com.caucho.network.listen.AbstractSocketLink
All Implemented Interfaces:
SocketLink
Direct Known Subclasses:
StreamSocketLink, TcpSocketLink

public abstract class AbstractSocketLink
extends java.lang.Object
implements SocketLink

Represents a protocol-independent connection. Protocol servers and their associated Requests use Connection to retrieve the read and write streams and to get information about the connection.

TcpConnection is the most common implementation. The test harness provides a string based Connection.


Constructor Summary
AbstractSocketLink()
           
 
Method Summary
 java.lang.String getCipherSuite()
          Returns the cipher suite
 java.security.cert.X509Certificate[] getClientCertificates()
          Returns any client certificates.
abstract  int getId()
          Returns the connection id.
 int getKeySize()
          Returns the key size.
abstract  java.net.InetAddress getLocalAddress()
          Returns the local address of the connection
 java.lang.String getLocalHost()
          Returns the remote client's inet address.
abstract  int getLocalPort()
          Returns the local port of the connection
 ReadStream getReadStream()
          Returns the connection's buffered read stream.
abstract  java.net.InetAddress getRemoteAddress()
          Returns the remote address of the connection
 int getRemoteAddress(byte[] buffer, int offset, int length)
          Returns the remote address of the connection
 java.lang.String getRemoteHost()
          Returns the remote client's inet address.
abstract  int getRemotePort()
          Returns the remove port of the connection
 com.caucho.network.listen.SocketLinkState getState()
           
 java.lang.String getVirtualHost()
          Returns the static virtual host
 WriteStream getWriteStream()
          Returns the connection's buffered write stream.
 boolean isCometActive()
          Returns true for a comet connection
 boolean isCometSuspend()
          Returns true for a comet connection
 boolean isDuplex()
          Returns true for a duplex connection
 boolean isKeepaliveAllocated()
           
 boolean isSecure()
          Returns true if secure (ssl)
 void killKeepalive(java.lang.String reason)
           
 void requestShutdownBegin()
           
 void requestShutdownEnd()
           
 AsyncController toComet(SocketLinkCometListener cometHandler)
          Starts a comet request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.caucho.network.listen.SocketLink
clientDisconnect, isPortActive, startDuplex
 

Constructor Detail

AbstractSocketLink

public AbstractSocketLink()
Method Detail

getId

public abstract int getId()
Returns the connection id. Primarily for debugging.

Specified by:
getId in interface SocketLink

getReadStream

public final ReadStream getReadStream()
Returns the connection's buffered read stream. If the ReadStream needs to block, it will automatically flush the corresponding WriteStream.

Specified by:
getReadStream in interface SocketLink

getWriteStream

public final WriteStream getWriteStream()
Returns the connection's buffered write stream. If the ReadStream needs to block, it will automatically flush the corresponding WriteStream.

Specified by:
getWriteStream in interface SocketLink

isSecure

public boolean isSecure()
Returns true if secure (ssl)

Specified by:
isSecure in interface SocketLink

getVirtualHost

public java.lang.String getVirtualHost()
Returns the static virtual host

Specified by:
getVirtualHost in interface SocketLink

getLocalAddress

public abstract java.net.InetAddress getLocalAddress()
Returns the local address of the connection

Specified by:
getLocalAddress in interface SocketLink

getLocalHost

public java.lang.String getLocalHost()
Returns the remote client's inet address.

Specified by:
getLocalHost in interface SocketLink

getLocalPort

public abstract int getLocalPort()
Returns the local port of the connection

Specified by:
getLocalPort in interface SocketLink

getRemoteAddress

public abstract java.net.InetAddress getRemoteAddress()
Returns the remote address of the connection

Specified by:
getRemoteAddress in interface SocketLink

getRemoteHost

public java.lang.String getRemoteHost()
Returns the remote client's inet address.

Specified by:
getRemoteHost in interface SocketLink

getRemoteAddress

public int getRemoteAddress(byte[] buffer,
                            int offset,
                            int length)
Returns the remote address of the connection

Specified by:
getRemoteAddress in interface SocketLink

getRemotePort

public abstract int getRemotePort()
Returns the remove port of the connection

Specified by:
getRemotePort in interface SocketLink

getCipherSuite

public java.lang.String getCipherSuite()
Returns the cipher suite

Specified by:
getCipherSuite in interface SocketLink

getKeySize

public int getKeySize()
Returns the key size.

Specified by:
getKeySize in interface SocketLink

getClientCertificates

public java.security.cert.X509Certificate[] getClientCertificates()
                                                           throws java.security.cert.CertificateException
Returns any client certificates.

Specified by:
getClientCertificates in interface SocketLink
Throws:
java.security.cert.CertificateException

isKeepaliveAllocated

public boolean isKeepaliveAllocated()
Specified by:
isKeepaliveAllocated in interface SocketLink

killKeepalive

public void killKeepalive(java.lang.String reason)
Specified by:
killKeepalive in interface SocketLink

requestShutdownBegin

public void requestShutdownBegin()
Specified by:
requestShutdownBegin in interface SocketLink

requestShutdownEnd

public void requestShutdownEnd()
Specified by:
requestShutdownEnd in interface SocketLink

getState

public com.caucho.network.listen.SocketLinkState getState()

isCometActive

public boolean isCometActive()
Returns true for a comet connection

Specified by:
isCometActive in interface SocketLink

isCometSuspend

public boolean isCometSuspend()
Returns true for a comet connection

Specified by:
isCometSuspend in interface SocketLink

isDuplex

public boolean isDuplex()
Returns true for a duplex connection

Specified by:
isDuplex in interface SocketLink

toComet

public AsyncController toComet(SocketLinkCometListener cometHandler)
Starts a comet request

Specified by:
toComet in interface SocketLink