You could prepare three `ReadTimeoutHandler` for this.
The first one is to time-out the connection when you are unsure if it's a plain HTTP connection or a Web Socket connection.
The second one is to time-out the plain HTTP connection.
The third one is to time-out the Web Socket connection.
Presumably, the first one and the second one might have the same timeout. Then you need only two ReadTimeoutHandlers.
Your pipeline starts with the first timeout handler, because you don't know which the current connection is.
When the client sends an HTTP request, you can determine if the current connection is Web Socket or not.
If the current connection is plain HTTP, you can replace the first timeout handler with the second timeout handler. If the first one and the second one are same, then of course you don't need to do anything.
If the current connection is Web Socket, you can replace the first timeout handler with the third timeout handler.
Because a Web Socket connection can be created in the middle of the plain HTTP keep-alive connection, you might end up replacing the timeout handlers twice. (first -> second -> third)
Please note you don't really need this sort of dynamic pipeline manipulation if you write your own timeout handler, which applies dynamic timeout based on the current HTTP message being processed, and it should be way more efficient.
HTH,
T