I'm trying to modify the value of MaxConcurrentStream for the tomcat server in
order to check that it returns a STREAM_REFUSED when the client uses more
streams, but I don't manage to change the default unlimited value.
I've been inspecting the tomcat server code with a debugger and I saw it enters
this method from the org.apache.coyote.http2.ConnectionSettingsLocal.java class
to change the value for maxConcurrentStream. Yet, if I'm not wrong, it only
modifies the pending hashSet not the current one, which is the one that is
checked later on to determine if it is lower than the clients' active streams
and therefore send the STREAM_REFUSED code.
@Override
protected synchronized void set(Setting setting, Long value) {
checkSend();
if (current.get(setting).longValue() == value.longValue()) {
pending.remove(setting);
} else {
pending.put(setting, value);
}
}
I'm not sure if I'm not modifying the value correctly, so here it's the code I
use to set the value:
Http2Protocol http2 = new Http2Protocol();
http2.setMaxConcurrentStreams(2);
...
connector.addUpgradeProtocol(http2);
I'd be grateful if someone could give me a hint of what is going on or what I'm
doing wrong. Thank you!