My crash into Java NIO

So at the moment while trying to come up with a nice API for Ciotola for network connections. I came up with a connection service API originally that just managed thread connections and dispatched the connection to an object which handles the connection. This meant that the client library required a lot of knowledge of the network layer, its behaviour, and use of the streams API (used Java Streams originally). The breakdown of the model came when the idea of adding SSL, now the JDK does have an SSL network stream, but its blocking. I was an idiot and used a plain network stream queried the available bytes, if that was zero it went to the next service. However in SSL sockets that function returns zero or not defined, also my implementation use of available bytes is not guaranteed depending on the platform.

The JDK SSL Engine is really built around NIO, and it seems that most of the JDK nowadays uses NIO to build the Socket Streams API.

One of the main ideas trying to implement is a wrapper around the JDK NIO which is usable, and can do a lot of work for a developer. The big idea is to use reflection to generate TLV messages for the developer. Similar to Spring you decorate a POJO that specifies the position and bytes for each field, which then creates the POJO with the filled in values and can be passed to the developers program, already parsed.

The other idea is to make it easy to insert different protocols and if SSL is required or not, one thing I noticed with NETTY was that if you didn't want HTTP or a protocol it didn't support it was PAIN, sure you could do it.

So the idea was to write something that would make it easy to encase protocols in SSL by passing it to a pipeline of sorts. Any way this has lead to an interesting sidetrack.