()
| 98 | |
| 99 | |
| 100 | @Test |
| 101 | public void testEmptyWindow() throws Exception { |
| 102 | int blockCount = 8; |
| 103 | |
| 104 | enableHttp2(); |
| 105 | |
| 106 | Tomcat tomcat = getTomcatInstance(); |
| 107 | |
| 108 | Context ctxt = getProgrammaticRootContext(); |
| 109 | Tomcat.addServlet(ctxt, "simple", new SimpleServlet()); |
| 110 | ctxt.addServletMappingDecoded("/simple", "simple"); |
| 111 | Wrapper w = Tomcat.addServlet(ctxt, "async", new AsyncServlet(blockCount, useNonContainerThreadForWrite)); |
| 112 | w.setAsyncSupported(true); |
| 113 | ctxt.addServletMappingDecoded("/async", "async"); |
| 114 | tomcat.start(); |
| 115 | |
| 116 | int startingWindowSize; |
| 117 | |
| 118 | openClientConnection(); |
| 119 | doHttpUpgrade(); |
| 120 | sendClientPreface(); |
| 121 | validateHttp2InitialResponse(); |
| 122 | |
| 123 | // Reset connection window size after initial response |
| 124 | sendWindowUpdate(0, SimpleServlet.CONTENT_LENGTH); |
| 125 | |
| 126 | if (largeInitialWindow) { |
| 127 | startingWindowSize = ((1 << 17) - 1); |
| 128 | SettingValue sv = new SettingValue(Setting.INITIAL_WINDOW_SIZE.getId(), startingWindowSize); |
| 129 | sendSettings(0, false, sv); |
| 130 | // Test code assumes connection window and stream window size are the same at the start |
| 131 | sendWindowUpdate(0, startingWindowSize - ConnectionSettingsBase.DEFAULT_INITIAL_WINDOW_SIZE); |
| 132 | } else { |
| 133 | startingWindowSize = ConnectionSettingsBase.DEFAULT_INITIAL_WINDOW_SIZE; |
| 134 | } |
| 135 | |
| 136 | byte[] frameHeader = new byte[9]; |
| 137 | ByteBuffer headersPayload = ByteBuffer.allocate(128); |
| 138 | buildGetRequest(frameHeader, headersPayload, null, 3, "/async"); |
| 139 | writeFrame(frameHeader, headersPayload); |
| 140 | |
| 141 | if (connectionUnlimited) { |
| 142 | // Effectively unlimited for this test |
| 143 | sendWindowUpdate(0, blockCount * BLOCK_SIZE * 2); |
| 144 | } |
| 145 | if (streamUnlimited) { |
| 146 | // Effectively unlimited for this test |
| 147 | sendWindowUpdate(3, blockCount * BLOCK_SIZE * 2); |
| 148 | } |
| 149 | |
| 150 | // Headers |
| 151 | parser.readFrame(); |
| 152 | // Body |
| 153 | |
| 154 | if (!connectionUnlimited || !streamUnlimited) { |
| 155 | while (output.getBytesRead() < startingWindowSize) { |
| 156 | parser.readFrame(); |
| 157 | } |
nothing calls this directly
no test coverage detected