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 |
|---|---|
ISocket |
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(ISocket 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(ISocket socket)
Checks if encryption (with SSL with any encryption - not only signing) is used.
|
boolean |
isStrongEncrypted(ISocket socket)
Checks if strong encryption (using SSL) is used.
|
boolean |
isUsingSSL()
Returns if SSL is used or not.
|
void |
performAcceptHandshake(ISocket s)
Performs the accept handshake for SSL.
|
boolean |
renegotiateSession(ISocket socket,
boolean isStrongEncryptionRequired,
boolean isClientAuthenticationRequired,
String accessControlID,
Thread readerThread)
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)
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).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).ServerSocketInterface3.IOException - When there is an I/O failure.public ISocket acceptNoHandshake() throws IOException
acceptNoHandshake in interface ServerSocketInterface2IOException - if an I/O error occurs when waiting for a connection.public void performAcceptHandshake(ISocket 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(ISocket socket, int index)
getInformation in interface ServerSocketInterfacesocket - The socket interface.index - index of the information requested.public boolean isUsingSSL()
isUsingSSL in interface ServerSocketInterfacepublic boolean isEncrypted(ISocket socket)
isEncrypted in interface ServerSocketInterfacepublic boolean isStrongEncrypted(ISocket socket)
isStrongEncrypted in interface ServerSocketInterfacepublic boolean renegotiateSession(ISocket socket, boolean isStrongEncryptionRequired, boolean isClientAuthenticationRequired, String accessControlID, Thread readerThread)
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 Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.