Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSSE: add basic RMI example client and server #226

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cconlon
Copy link
Member

@cconlon cconlon commented Oct 16, 2024

This PR adds an example RMI client and server that work over TLS, located in the examples/provider/rmi directory. Examples are compiled when ant examples is run:

$ ./java.sh
$ ant
$ ant examples

Then, the client and server can be run from the wolfssljni root:

./examples/provider/rmi/RmiServer.sh
./examples/provider/rmi/RmiClient.sh

examples/provider/rmi/RmiServer.java - RMI server (implements RmiRemoteInterface)
examples/provider/rmi/RmiClient.java - RMI client
examples/provider/rmi/RmiRemoteInterface.java - RMI remote object interface
examples/provider/rmi/RmiTLSClientSocketFactory.java - client TLS socket factory for RMI
examples/provider/rmi/RmiTLSServerSocketFactory.java - server TLS socket factory for RMI

Expected output should be:

$ ./examples/provider/rmi/RmiServer.sh
Created server TrustManagerFactory
Created server KeyManagerFactory
Created server SSLContext
Created server SSLServerSocketFactory
Creating server Socket
Created server TrustManagerFactory
Created server KeyManagerFactory
Created server SSLContext
Created server SSLServerSocketFactory
Server started, listening for connections

$ ./examples/provider/rmi/RmiClient.sh
Created client TrustManagerFactory
Created client KeyManagerFactory
Created client SSLContext
Created client SocketFactory
Creating client Socket
Created client TrustManagerFactory
Created client KeyManagerFactory
Created client SSLContext
Created client SocketFactory
Creating client Socket
Message from server via RMI: Hello from server

Each example can take a number of arguments. The server is set up to create one RMI registry at a starting port of 11115. If the -n XX option is used on the server side, that number of RMI registry ports will be created. The client is set up to make one connection to the server, and get an array of available ports. It will then make by default one connection to each of those ports. If -n XX is used on the client example, the client will make XX connections to each available RMI service port.

Example client usage options:

Java RMI example threaded client usage:
-n <num>	Number of client connection rounds
-randsleep	Random sleep before starting threads
-newSF	Use new SocketFactory for each client connection

Example server usage options:

Java RMI example server usage:
-n <num>	Number of server registries to create, port numbers increment from 11115
-jsseProv <String>	JSSE provider to use (ex: wolfJSSE, SunJSSE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant