org.norther.tammi.acorn.nio
Class SSLServerSocketChannel

java.lang.Object
  extended by java.nio.channels.spi.AbstractInterruptibleChannel
      extended by java.nio.channels.SelectableChannel
          extended by java.nio.channels.spi.AbstractSelectableChannel
              extended by java.nio.channels.ServerSocketChannel
                  extended by org.norther.tammi.acorn.nio.SSLServerSocketChannel
All Implemented Interfaces:
Closeable, Channel, InterruptibleChannel, AdaptableChannel

public class SSLServerSocketChannel
extends ServerSocketChannel
implements AdaptableChannel

A secure server socket channel implementation enclosing accepted non-secure SocketChannels into SSLSocketChannels. The accepted channels must be provided by an adapted non-secure concrete ServerSocketChannel implementation.

This implementation extends abstract ServerSocketChannel and forwards applicable calls to methods of the adapted concrete implementation. It also implements AdaptableChannel as selectors typically don't accept channel implementations from other vendors, so the selector registration must be done with the adaptee channel.

Author:
Ilkka Priha

Constructor Summary
SSLServerSocketChannel(ServerSocketChannel channel, SSLContext context)
          Construct a new channel.
 
Method Summary
 SocketChannel accept()
           
 Channel getAdapteeChannel()
          Gets the adaptee of this adaptable channel.
 boolean getNeedClientAuth()
          Checks whether client authentication is needed.
 boolean getWantClientAuth()
          Checks whether client authentication is wanted.
protected  void implCloseSelectableChannel()
           
protected  void implConfigureBlocking(boolean block)
           
 void setNeedClientAuth(boolean flag)
          Sets whether client authentication is needed.
 void setWantClientAuth(boolean flag)
          Sets whether client authentication is wanted.
 ServerSocket socket()
           
 String toString()
           
 
Methods inherited from class java.nio.channels.ServerSocketChannel
open, validOps
 
Methods inherited from class java.nio.channels.spi.AbstractSelectableChannel
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, register
 
Methods inherited from class java.nio.channels.SelectableChannel
register
 
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 

Constructor Detail

SSLServerSocketChannel

public SSLServerSocketChannel(ServerSocketChannel channel,
                              SSLContext context)
Construct a new channel.

Parameters:
channel - the unsecure socket channel.
context - the SSL context.
Method Detail

socket

public ServerSocket socket()
Specified by:
socket in class ServerSocketChannel

accept

public SocketChannel accept()
                     throws IOException
Specified by:
accept in class ServerSocketChannel
Throws:
IOException

getAdapteeChannel

public Channel getAdapteeChannel()
Description copied from interface: AdaptableChannel
Gets the adaptee of this adaptable channel.

Specified by:
getAdapteeChannel in interface AdaptableChannel
Returns:
the adaptee channel.

toString

public String toString()
Overrides:
toString in class Object

getWantClientAuth

public boolean getWantClientAuth()
Checks whether client authentication is wanted.

Returns:
true for client authentication, false otherwise.

setWantClientAuth

public void setWantClientAuth(boolean flag)
Sets whether client authentication is wanted.

Parameters:
flag - true for client authentication, false otherwise.

getNeedClientAuth

public boolean getNeedClientAuth()
Checks whether client authentication is needed.

Returns:
true for client authentication, false otherwise.

setNeedClientAuth

public void setNeedClientAuth(boolean flag)
Sets whether client authentication is needed.

Parameters:
flag - true for client authentication, false otherwise.

implCloseSelectableChannel

protected void implCloseSelectableChannel()
                                   throws IOException
Specified by:
implCloseSelectableChannel in class AbstractSelectableChannel
Throws:
IOException

implConfigureBlocking

protected void implConfigureBlocking(boolean block)
                              throws IOException
Specified by:
implConfigureBlocking in class AbstractSelectableChannel
Throws:
IOException


Copyright © 2004 The Norther Organization. All rights reserved.