209 this.serverSettings = SettingsFrame.getDefaultSettings(); |
209 this.serverSettings = SettingsFrame.getDefaultSettings(); |
210 this.hpackOut = new Encoder(serverSettings.getParameter(HEADER_TABLE_SIZE)); |
210 this.hpackOut = new Encoder(serverSettings.getParameter(HEADER_TABLE_SIZE)); |
211 this.hpackIn = new Decoder(clientSettings.getParameter(HEADER_TABLE_SIZE)); |
211 this.hpackIn = new Decoder(clientSettings.getParameter(HEADER_TABLE_SIZE)); |
212 this.windowUpdater = new ConnectionWindowUpdateSender(this, client.getReceiveBufferSize()); |
212 this.windowUpdater = new ConnectionWindowUpdateSender(this, client.getReceiveBufferSize()); |
213 } |
213 } |
214 /** |
214 |
215 * Case 1) Create from upgraded HTTP/1.1 connection. |
215 /** |
216 * Is ready to use. Will not be SSL. exchange is the Exchange |
216 * Case 1) Create from upgraded HTTP/1.1 connection. |
217 * that initiated the connection, whose response will be delivered |
217 * Is ready to use. Will not be SSL. exchange is the Exchange |
218 * on a Stream. |
218 * that initiated the connection, whose response will be delivered |
219 */ |
219 * on a Stream. |
|
220 */ |
220 Http2Connection(HttpConnection connection, |
221 Http2Connection(HttpConnection connection, |
221 Http2ClientImpl client2, |
222 Http2ClientImpl client2, |
222 Exchange<?> exchange, |
223 Exchange<?> exchange, |
223 ByteBuffer initial) |
224 ByteBuffer initial) |
224 throws IOException, InterruptedException |
225 throws IOException, InterruptedException |
278 |
279 |
279 /** |
280 /** |
280 * Throws an IOException if h2 was not negotiated |
281 * Throws an IOException if h2 was not negotiated |
281 */ |
282 */ |
282 private void checkSSLConfig() throws IOException { |
283 private void checkSSLConfig() throws IOException { |
283 AsyncSSLConnection aconn = (AsyncSSLConnection)connection; |
284 AbstractAsyncSSLConnection aconn = (AbstractAsyncSSLConnection)connection; |
284 SSLEngine engine = aconn.getEngine(); |
285 SSLEngine engine = aconn.getEngine(); |
285 String alpn = engine.getApplicationProtocol(); |
286 String alpn = engine.getApplicationProtocol(); |
286 if (alpn == null || !alpn.equals("h2")) { |
287 if (alpn == null || !alpn.equals("h2")) { |
287 String msg; |
288 String msg; |
288 if (alpn == null) { |
289 if (alpn == null) { |
904 /** |
905 /** |
905 * Thrown when https handshake negotiates http/1.1 alpn instead of h2 |
906 * Thrown when https handshake negotiates http/1.1 alpn instead of h2 |
906 */ |
907 */ |
907 static final class ALPNException extends IOException { |
908 static final class ALPNException extends IOException { |
908 private static final long serialVersionUID = 23138275393635783L; |
909 private static final long serialVersionUID = 23138275393635783L; |
909 final AsyncSSLConnection connection; |
910 final AbstractAsyncSSLConnection connection; |
910 |
911 |
911 ALPNException(String msg, AsyncSSLConnection connection) { |
912 ALPNException(String msg, AbstractAsyncSSLConnection connection) { |
912 super(msg); |
913 super(msg); |
913 this.connection = connection; |
914 this.connection = connection; |
914 } |
915 } |
915 |
916 |
916 AsyncSSLConnection getConnection() { |
917 AbstractAsyncSSLConnection getConnection() { |
917 return connection; |
918 return connection; |
918 } |
919 } |
919 } |
920 } |
920 } |
921 } |