|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ssonet.examples.net.TestClient
The client of a simple example implementation for a network connection using
the SSONET library. Immediately after starting, the client reads its
security configuration form the predefined user named "Client". Then it connects
to the TestServer
-Server and establishes a connection.
The established connection is used to send some data to the server.
The client implements all listeners needed to influence SSONET connection establishment
according to the clients preferences.
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 | |
TestClient()
|
|
TestClient(int connectionCount)
|
Method Summary | |
int |
checkCertificate(org.ssonet.net.SSONETContext context,
java.security.cert.X509Certificate certificate)
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 listener SSONETContextListener . |
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. |
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 TestClient()
public TestClient(int connectionCount)
Method Detail |
public static void main(java.lang.String[] arg)
public org.ssonet.net.SSONETContext createContext()
SSONETContextListener
.
When a new SSONETClientSocket is created by the SSONETClientSocketFactory, a
SSONETContext is requested for use in the SSONETClientSocket by using this
method.
createContext
in interface SSONETContextFactory
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 certificate)
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 checkcertificate
- 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 |