Server Push will only work under SSL. In other words, if you are using GlassFish 5 and try 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. means that when the code asks for newPushBuilder, it will return null (not available):
if (pb != null) {
...
}