Skip to content

IntroConnections

Thomas Schwotzer edited this page Sep 11, 2023 · 12 revisions

An ASAP peer is a protocol engine. Not more, not less. An ASAP peer is not able set up any connection. It can run a ASAP session on an existing connection. Interface ASAPConnectionHandler. describes that fact:

package net.sharksystem.asap;
...
public interface ASAPConnectionHandler {
     ...
     ASAPConnection handleConnection(InputStream is, OutputStream os) throws IOException, ASAPException;
     ...
}

Our ASAPPeerFS class implements this interface.

// somewehere in your app, a peer is created from a real class
ASAPPeerFS peer = new ASAPPeerFS(owner, rootFolder, supportedFormats);
// app developers focus on ASAPPeer interface
ASAPPeer asapPeer = peer;
// network support use ASAPConnectionHandler
ASAPConnectionHandler connectionHandler = peer;

Our peers expect an input and output stream to run an ASAP session. Our ASAP application require means to create those streams.

Asking for those streams is not a harsh constraint. TCP provides streams, Bluetooth does, even LoRa-Wan can produce a stream based connection. In short, any protocol that provides streams can be used to run an ASAP session. That's a lot and far more than just Internet (IP based networks).

This project provides some utilities to deal with such connection regardless of underlaying technology. Let's start with test support since we strongly believe in the power of test driven development.