public class DefaultServerSocket extends SocketHelper implements ServerSocketInterface2
As SSL requires additional parameters that are generally implementation dependent, the "server.ini" file object is passed along. This makes it possible to access information in - typically - the "[SSL]" section of the file.
id, isLoadBalancedSSLINFO_CLIENTCERT_ISSUER, SSLINFO_CLIENTCERT_PUBLICKEYFORMAT, SSLINFO_CLIENTCERT_SERIALNUMBER, SSLINFO_CLIENTCERT_SIGNATUREALGORITHM, SSLINFO_CLIENTCERT_SUBJECT, SSLINFO_CLIENTCERT_VALIDFROM, SSLINFO_CLIENTCERT_VALIDTO, SSLINFO_CLIENTCERT_VERSION, SSLINFO_GETCIPHER, SSLINFO_GETEFFECTIVEBITS, SSLINFO_ISENCRYPTED, SSLINFO_ISSTRONGENCRYPTED| Constructor and Description |
|---|
DefaultServerSocket()
Constructor for the default server socket from NetPhantom Server.
|
| Modifier and Type | Method and Description |
|---|---|
Socket |
accept()
Listens for a connection to be made to this socket and accepts it.
|
Socket |
acceptNoHandshake()
Listens for a connection to be made to this socket and accepts it.
|
void |
close()
Closes this socket.
|
ServerSocketInterface2 |
createServerSocket(String id,
int port,
int mapToPort,
int count,
InetAddress address)
Creates the ServerSocket listener.
|
InetAddress |
getInetAddress()
Returns the local address of this server socket.
|
String |
getInformation(Socket socket,
int index)
Returns SSL information about this socket.
|
int |
getLocalPort()
Returns the port on which this socket is listening.
|
int |
getMapToPort()
Gets the port number being mapped to externally.
|
void |
initialize(IniFile ini,
String name)
Initializes the server socket with information in the INI file for the SSL
protocol.
|
boolean |
isEncrypted(Socket socket)
Checks if encryption (with SSL with any encryption - not only signing) is used.
|
boolean |
isStrongEncrypted(Socket socket)
Checks if strong encryption (using SSL) is used.
|
boolean |
isUsingSSL()
Returns if SSL is used or not.
|
void |
performAcceptHandshake(Socket s)
Performs the accept handshake for SSL.
|
boolean |
renegotiateSession(Socket socket,
boolean isStrongEncryptionRequired,
boolean isClientAuthenticationRequired,
String accessControlID)
If an SSL connection is not using strong encryption or if a client certificate
is required, call this method.
|
void |
setExternalSSL(boolean isExternal)
Sets the external SSL flag.
|
String |
toString()
Returns the implementation address and implementation port of this
socket as a String.
|
getLocalAddress, getLocalName, getPortID, isLoadBalanced, setLoadBalancingclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetLocalAddress, getLocalName, getPortID, isLoadBalanced, setLoadBalancingpublic DefaultServerSocket()
public void initialize(IniFile ini, String name) throws IOException
name
parameter set to null.initialize in interface ServerSocketInterface2ini - the "server.ini" file from where the potential SSL
package reads information to create the server socket.name - the section name in the INI file where all settings are
stored (null when no SSL).IOException - When there is an I/O failure.public void setExternalSSL(boolean isExternal)
setExternalSSL in interface ServerSocketInterfacepublic ServerSocketInterface2 createServerSocket(String id, int port, int mapToPort, int count, InetAddress address) throws IOException
createServerSocket in interface ServerSocketInterface2id - the ID of the port.port - the port.mapToPort - the port externally mapped.count - the number of queued connection requests.address - the address to listen to (null means all local addresses).IOException - When there is an I/O failure.public Socket accept() throws IOException
accept in interface ServerSocketInterface2IOException - if an I/O error occurs when waiting for a connection.public Socket acceptNoHandshake() throws IOException
acceptNoHandshake in interface ServerSocketInterface2IOException - if an I/O error occurs when waiting for a connection.public void performAcceptHandshake(Socket s) throws IOException
performAcceptHandshake in interface ServerSocketInterface2IOException - if an I/O error occurs when waiting for a connection.public InetAddress getInetAddress()
getInetAddress in interface ServerSocketInterfacepublic int getLocalPort()
getLocalPort in interface ServerSocketInterfacepublic int getMapToPort()
getLocalPort
is returned.getMapToPort in interface ServerSocketInterfacepublic String getInformation(Socket socket, int index)
getInformation in interface ServerSocketInterfaceindex - index of the information requested.public boolean isUsingSSL()
isUsingSSL in interface ServerSocketInterfacepublic boolean isEncrypted(Socket socket)
isEncrypted in interface ServerSocketInterfacepublic boolean isStrongEncrypted(Socket socket)
isStrongEncrypted in interface ServerSocketInterfacepublic boolean renegotiateSession(Socket socket, boolean isStrongEncryptionRequired, boolean isClientAuthenticationRequired, String accessControlID)
renegotiateSession in interface ServerSocketInterfacepublic void close()
throws IOException
close in interface ServerSocketInterfaceIOException - if an I/O error occurs when closing the socket.public String toString()
toString in interface ServerSocketInterfacetoString in class ObjectPhantom® and NetPhantom® are registered trademarks of Nexum Technologies SARL.
© Copyright Nexum Technologies SARL, 2011. All rights reserved.