This method is a copy paste of the stdlib method, with the internal ServerHandler class modified. It was the only way to change the ServerHandler class used without monkey patching.