|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ssonet.examples.net.TestServer
This class implements a simple server using the SSONET-library.
Field Summary | |
(package private) org.ssonet.net.SSONETContext |
context
|
static boolean |
debug
|
Fields inherited from interface org.ssonet.net.CertificateListener |
INVALID, NOT_TESTED, VALID |
Fields inherited from interface org.ssonet.net.ConnectionListener |
FINISHED_STATE, INIT_STATE, MECHANISMS_NEGOTIATION, NOT_STARTED_STATE, RUNNING_STATE, SECURITY_GOAL_NEGOTIATION |
Constructor Summary | |
TestServer()
|
|
TestServer(int packets)
|
Method Summary | |
int |
checkCertificate(org.ssonet.net.SSONETContext context,
java.security.cert.X509Certificate cert)
Method of the implemented listener CertificateListener . |
void |
connectionStateChanged(org.ssonet.net.SSONETContext context,
int currentState)
When the connection state has changed, this method reports the current state. |
void |
contextChanged(org.ssonet.net.SSONETContext c)
Method of the implemented listener SSONETContextListener . |
org.ssonet.net.SSONETContext |
createContext()
Method of the implemented SSONETContextFactory . |
boolean |
decideSecurityGoal(int securityGoal,
org.ssonet.net.ActionConfiguration ownConfiguration,
org.ssonet.net.SSONETContext context)
Method of the implemented listener NegotiationListener . |
static void |
main(java.lang.String[] arg)
The main method of the server. |
void |
negotiationRequestReceived(org.ssonet.net.SSONETContext context,
int negotiationType)
The method negotiationRequestReceived() is called by
SSONETProtocolStream , when a request for a
security goal and mechanisms negotiation, or only a mechanisms negotiation
was received, but before the negotiation of security parameters starts. |
void |
replaceContext(org.ssonet.net.SSONETContext o,
org.ssonet.net.SSONETContext n)
Method of the implemented listener SSONETContextListener . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean debug
org.ssonet.net.SSONETContext context
Constructor Detail |
public TestServer()
public TestServer(int packets)
packets
- is not used hereMethod Detail |
public static void main(java.lang.String[] arg)
arg
- command line arguments (not used).public org.ssonet.net.SSONETContext createContext()
SSONETContextFactory
.
It creates a SSONETContext
object from the security
configuration of the predefined user named "Standardkunde".
Further, it registers the listeners, which are implemented by this server,
with the created SSONETContext
.
This server implements all
listeners needed to influence SSONET connection establishment
according to the servers preferences.
createContext
in interface SSONETContextFactory
SSONETContext
object.public void contextChanged(org.ssonet.net.SSONETContext c)
SSONETContextListener
.
This method is called, if data in the SSONETContext has changed. This listener is
particularily usefull, if an application using SSONET has different modules,
which need to react to changes in the context data.
contextChanged
in interface SSONETContextListener
c
- the SSONETContext, which has changed.public void replaceContext(org.ssonet.net.SSONETContext o, org.ssonet.net.SSONETContext n)
SSONETContextListener
.
In applications with different modules, the according method in SSONETContext
can be called by a module,
which want do completely replace a SSONETContext. Other modules may update
their SSONETContexts by this method.
replaceContext
in interface SSONETContextListener
o
- the old SSONETContextn
- the replacement SSONETContextpublic int checkCertificate(org.ssonet.net.SSONETContext context, java.security.cert.X509Certificate cert)
CertificateListener
.
When a certificate is received from the communication partner, this method
is called. It should decide about the validity the the certificate.
In SSONETContext
, multiple CertificateListener
s
can be registered. A certificate is considered valid, if no CertificateListener
says "invalid" and at least one CertificateListener says "valid".
checkCertificate
in interface CertificateListener
context
- the SSONETContext
object, which requested the certificate checkcert
- the certificate to check
CertificateListener.VALID
if the certificate is valid,CertificateListener.INVALID
if the certificate is invalid,CertificateListener.NOT_TESTED
if this method did not decide about the certificates validity.public boolean decideSecurityGoal(int securityGoal, org.ssonet.net.ActionConfiguration ownConfiguration, org.ssonet.net.SSONETContext context)
NegotiationListener
.
If the first round of negotiation of security goals resulted in a conflict,
but it was configured to make a new decision in case of a conflict, this
method is called. It decides about giving in or not for the conflicting
security goal.
In SSONETContext
, multiple NegotiationListener
s
can be registered. If at least one listener gives in, i.e. returns true
,
it is giving in in this conflict.
decideSecurityGoal
in interface ConnectionListener
securityGoal
- the conflicting security goalownConfiguration
- the configuration of security goals, which is used for the negotiationcontext
- the SSONETContext
object, which requested the security goal conflict resolution.
true
, if it is giving in in the conflict,false
, if the decistion about the security goal is not changed.public void negotiationRequestReceived(org.ssonet.net.SSONETContext context, int negotiationType)
ConnectionListener
negotiationRequestReceived()
is called by
SSONETProtocolStream
, when a request for a
security goal and mechanisms negotiation, or only a mechanisms negotiation
was received, but before the negotiation of security parameters starts.
negotiationRequestReceived
in interface ConnectionListener
context
- the SSONETContext
used by the server for this
request.negotiationType
- SECURITY_GOAL_NEGOTIATION
if the negotiation
requested is a security goal (and mechanisms) negotiation,
MECHANISMS_NEGOTIATION
if the negotiation requested is only a
mechanisms negotiation.
public void connectionStateChanged(org.ssonet.net.SSONETContext context, int currentState)
ConnectionListener
connectionStateChanged
in interface ConnectionListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |