package

com.ericsson.research.trap.examples

This package contains a set of examples on how to use Trap. These examples are fully executable, and include main() methods, but require a Trap implementation to run. If using Maven, ensure that the appropriate transports are added to your project's dependencies.

Note that these examples do not follow proper data isolation practices! Most/all fields are marked public in order to allow easy integration testing. This ensures the examples all run, but does not make proper coding practice. When using these samples in your own code, please ensure that the fields are properly marked as private, protected or default scope.

The examples are client/server pairs based on a certain topics. The topics covered are:

  • Echo: A simple Hello World example with a server that echoes back any data it receives, and a client that continuously sends messages.
  • Configured: Comprehensive list of the configuration options that may be applied to clients and servers.
  • Authenticated: Shows how to attach (mutual) authentication to identify a Trap session.
  • Multiplexed: Leveraging Trap channels to allow multiple simultaneous flows.
  • Delegate: Highlights how we can attach multiple delegates to handle different tasks.

Classes

AuthenticatedEchoClient Connects to the echo server and sends messages to be echoed back. 
AuthenticatedEchoServer A simple authenticated server, using a static authentication algorithm. 
AutoConfiguredServer Shows how to use automatic configuration to simplify client connections using the new Trap 1.2 API. 
ConfiguredClient Similar to the configured server, this sample shows how to tweak a client's configuration. 
ConfiguredServer This example focuses on tweaking a server's configuration. 
DelegateEchoClient Implements the echo client by setting multiple independent delegate objects instead. 
EchoClient Connects to the echo server and sends messages to be echoed back. 
EchoServer This example provides a simple echo server. 
MultiplexedClient Showcases how to use Trap Channels to send multiple data flows at the same time. 
MultiplexedServer A server capable of echoing to the MultiplexedClient. 
TLSEchoServer This example provides a simple echo server. 
TLSInsecureEchoClient Connects to the echo server and sends messages to be echoed back. 
TLSInsecureEchoServer This example provides a simple echo server.