The problem with that is, if a malicious client floods the Socket from which the [Concurrent]CommunicationService reads the bytes, then it will cache as long as the underlying buffer (ByteArrayOutputStream) is capable of that.
Although if an Exception (either ClientNotConnected - in case of Communication Service, or IOException - in case of ConcurrentCommunicationService) is thrown, then the method which called the [Concurrent]CommunicationService.receive() will close the respective connection (along with the Socket stored inside). It is because that method thinks the connection was closed by the other side.
But I'm not sure if a ByteArrayOutputStream can ever be full...
where * can be:
The problem with that is, if a malicious client floods the Socket from which the [Concurrent]CommunicationService reads the bytes, then it will cache as long as the underlying buffer (
ByteArrayOutputStream
) is capable of that.Although if an Exception (either ClientNotConnected - in case of Communication Service, or IOException - in case of ConcurrentCommunicationService) is thrown, then the method which called the
[Concurrent]CommunicationService.receive()
will close the respective connection (along with the Socket stored inside). It is because that method thinks the connection was closed by the other side.But I'm not sure if a
ByteArrayOutputStream
can ever be full...