Server Push will only work under the Secure Sockets Layer (SSL). In other words, if you are using Eclipse GlassFish 5 and are trying to run this recipe, your URL should be something like this:
https://localhost:8181/ch04-serverpush
If you miss it, the code will still work but using HTTP/1.0, which means that when the code asks for newPushBuilder, it will return null (not available):
if (pb != null) {
...
}
So, if you really mean to use Server Push, it would be a good idea to let all set (install an SSL certificate, for example) and maybe close the 8080 port (so you can guarantee that your Server Push code is used).