Writing scalable server applications in the Java™ programming language has always been difficult. Before the advent of the Java New I/O API (NIO), thread management issues made it impossible for a server to scale to thousands of users. The Grizzly NIO framework has been designed to help developers to take advantage of the Java™ NIO API.
At first glance, my guess is because the session output stream uses connection.write() vs filterchaincontext.write() we lose the original context that the port unification is looking for and hence the NPE.
We're not going to address this issue for 2.4. Grizzly 3.0 has a connection-based port unification approach vs request/response as is done in 2.4. We'll document this decision.
See https://github.com/javaee/glassfish/issues/21764.
At first glance, my guess is because the session output stream uses connection.write() vs filterchaincontext.write() we lose the original context that the port unification is looking for and hence the NPE.