edu.emory.mathcs.util.net.ssl
Class SSLServerSocketWrapper

java.lang.Object
  extended byjava.net.ServerSocket
      extended byjavax.net.ssl.SSLServerSocket
          extended byedu.emory.mathcs.util.net.ssl.SSLServerSocketWrapper

public class SSLServerSocketWrapper
extends javax.net.ssl.SSLServerSocket

Wrapper for SSL server sockets which enables to add functionality in subclasses on top of existing, bound SSL server sockets. It is useful when direct subclassing of delegate socket class is not possible, e.g. if the delegate socket is created by a library. Possible usage example is socket factory chaining. This class delegates all socket-related requests to the wrapped delegate, as of JDK 1.4.

Version:
1.4
Author:
Dawid Kurzyniec

Constructor Summary
protected SSLServerSocketWrapper(javax.net.ssl.SSLServerSocket delegate)
          Creates new socket wrapper for a given server socket.
 
Method Summary
 java.net.Socket accept()
           
 void close()
           
 boolean equals(java.lang.Object obj)
           
 java.nio.channels.ServerSocketChannel getChannel()
           
 java.lang.String[] getEnabledCipherSuites()
           
 java.lang.String[] getEnabledProtocols()
           
 boolean getEnableSessionCreation()
           
 java.net.InetAddress getInetAddress()
           
 int getLocalPort()
           
 java.net.SocketAddress getLocalSocketAddress()
           
 boolean getNeedClientAuth()
           
 int getReceiveBufferSize()
           
 boolean getReuseAddress()
           
 int getSoTimeout()
           
 java.lang.String[] getSupportedCipherSuites()
           
 java.lang.String[] getSupportedProtocols()
           
 boolean getUseClientMode()
           
 boolean getWantClientAuth()
           
 int hashCode()
           
 boolean isBound()
           
 boolean isClosed()
           
 void setEnabledCipherSuites(java.lang.String[] enabledCipherSuites)
           
 void setEnabledProtocols(java.lang.String[] protocols)
           
 void setEnableSessionCreation(boolean enable)
           
 void setNeedClientAuth(boolean want)
           
 void setReceiveBufferSize(int size)
           
 void setReuseAddress(boolean on)
           
 void setSoTimeout(int timeout)
           
 void setUseClientMode(boolean clientMode)
           
 void setWantClientAuth(boolean want)
           
 java.lang.String toString()
           
protected  javax.net.ssl.SSLSocket wrapAcceptedSocket(javax.net.ssl.SSLSocket accepted)
           
 
Methods inherited from class java.net.ServerSocket
bind, bind, implAccept, setSocketFactory
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SSLServerSocketWrapper

protected SSLServerSocketWrapper(javax.net.ssl.SSLServerSocket delegate)
                          throws java.io.IOException
Creates new socket wrapper for a given server socket. The delegate must be bound and it must not be closed.

Parameters:
delegate - the delegate socket to wrap.
Throws:
java.net.SocketException - if the delegate socket is closed, not bound, or not connected.
java.io.IOException
Method Detail

wrapAcceptedSocket

protected javax.net.ssl.SSLSocket wrapAcceptedSocket(javax.net.ssl.SSLSocket accepted)
                                              throws java.net.SocketException
Throws:
java.net.SocketException

isBound

public boolean isBound()

isClosed

public boolean isClosed()

getInetAddress

public java.net.InetAddress getInetAddress()

getLocalPort

public int getLocalPort()

getLocalSocketAddress

public java.net.SocketAddress getLocalSocketAddress()

accept

public java.net.Socket accept()
                       throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

getChannel

public java.nio.channels.ServerSocketChannel getChannel()

setSoTimeout

public void setSoTimeout(int timeout)
                  throws java.net.SocketException
Throws:
java.net.SocketException

getSoTimeout

public int getSoTimeout()
                 throws java.io.IOException
Throws:
java.io.IOException

setReuseAddress

public void setReuseAddress(boolean on)
                     throws java.net.SocketException
Throws:
java.net.SocketException

getReuseAddress

public boolean getReuseAddress()
                        throws java.net.SocketException
Throws:
java.net.SocketException

toString

public java.lang.String toString()

setReceiveBufferSize

public void setReceiveBufferSize(int size)
                          throws java.net.SocketException
Throws:
java.net.SocketException

getReceiveBufferSize

public int getReceiveBufferSize()
                         throws java.net.SocketException
Throws:
java.net.SocketException

getSupportedProtocols

public java.lang.String[] getSupportedProtocols()

getEnabledProtocols

public java.lang.String[] getEnabledProtocols()

setEnabledProtocols

public void setEnabledProtocols(java.lang.String[] protocols)

getSupportedCipherSuites

public java.lang.String[] getSupportedCipherSuites()

getEnabledCipherSuites

public java.lang.String[] getEnabledCipherSuites()

setEnabledCipherSuites

public void setEnabledCipherSuites(java.lang.String[] enabledCipherSuites)

getWantClientAuth

public boolean getWantClientAuth()

setWantClientAuth

public void setWantClientAuth(boolean want)

getNeedClientAuth

public boolean getNeedClientAuth()

setNeedClientAuth

public void setNeedClientAuth(boolean want)

getUseClientMode

public boolean getUseClientMode()

setUseClientMode

public void setUseClientMode(boolean clientMode)

getEnableSessionCreation

public boolean getEnableSessionCreation()

setEnableSessionCreation

public void setEnableSessionCreation(boolean enable)

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()