de.knipp.rritoolkit.tcp
Class TcpChannelFactory

java.lang.Object
  extended by de.knipp.rritoolkit.tcp.TcpChannelFactory
All Implemented Interfaces:
ChannelFactory

public class TcpChannelFactory
extends java.lang.Object
implements ChannelFactory

class that implements the ChannelFactory interface for SSL/TLS secured TCP connections

Version:
$Revision: 14936 $
Author:
Klaus Malorny

Field Summary
private  TcpParams params
          the parameters
private  javax.net.ssl.SSLSocketFactory socketFactory
          the socket factory
 
Constructor Summary
TcpChannelFactory(TcpParams theParams)
          constructor
 
Method Summary
 RegistryChannel createChannel()
          create a new channel.
private  void verifyServerName(javax.net.ssl.SSLSocket socket)
          verify that the common name of the server certificate's subject is identical with the reverse mapping of the servers address
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

params

private TcpParams params
the parameters


socketFactory

private javax.net.ssl.SSLSocketFactory socketFactory
the socket factory

Constructor Detail

TcpChannelFactory

public TcpChannelFactory(TcpParams theParams)
constructor

Parameters:
theParams - the parameters
Method Detail

createChannel

public RegistryChannel createChannel()
                              throws java.io.IOException
create a new channel. If a implementation or configuration specific limit of number of channels exists and this limit has been reached, null is returned. If a channel could not be created for a different reason, an IOException is thrown. Channels that are no longer used by the caller should be closed

Specified by:
createChannel in interface ChannelFactory
Returns:
the channel or null if no more channels are available
Throws:
java.io.IOException - if the channel could not be created

verifyServerName

private void verifyServerName(javax.net.ssl.SSLSocket socket)
                       throws java.io.IOException,
                              java.security.GeneralSecurityException
verify that the common name of the server certificate's subject is identical with the reverse mapping of the servers address

Parameters:
socket - the socket
Throws:
java.io.IOException - on SSL related I/O exceptions
java.security.GeneralSecurityException - if the addresses do not match


Copyright © 2005-2011 Knipp Medien und Kommunikation GmbH