< prev index next >
test/jdk/java/net/httpclient/http2/jdk.incubator.httpclient/jdk/incubator/http/internal/hpack/EncoderTest.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -22,10 +22,11 @@
*/
package jdk.incubator.http.internal.hpack;
import org.testng.annotations.Test;
+import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -518,33 +519,33 @@
" Table size: 215");
// @formatter:on
}
@Test
- public void initialSizeUpdateDefaultEncoder() {
+ public void initialSizeUpdateDefaultEncoder() throws IOException {
Function<Integer, Encoder> e = Encoder::new;
testSizeUpdate(e, 1024, asList(), asList(0));
testSizeUpdate(e, 1024, asList(1024), asList(0));
testSizeUpdate(e, 1024, asList(1024, 1024), asList(0));
testSizeUpdate(e, 1024, asList(1024, 512), asList(0));
testSizeUpdate(e, 1024, asList(512, 1024), asList(0));
testSizeUpdate(e, 1024, asList(512, 2048), asList(0));
}
@Test
- public void initialSizeUpdateCustomEncoder() {
+ public void initialSizeUpdateCustomEncoder() throws IOException {
Function<Integer, Encoder> e = EncoderTest::newCustomEncoder;
testSizeUpdate(e, 1024, asList(), asList(1024));
testSizeUpdate(e, 1024, asList(1024), asList(1024));
testSizeUpdate(e, 1024, asList(1024, 1024), asList(1024));
testSizeUpdate(e, 1024, asList(1024, 512), asList(512));
testSizeUpdate(e, 1024, asList(512, 1024), asList(1024));
testSizeUpdate(e, 1024, asList(512, 2048), asList(2048));
}
@Test
- public void seriesOfSizeUpdatesDefaultEncoder() {
+ public void seriesOfSizeUpdatesDefaultEncoder() throws IOException {
Function<Integer, Encoder> e = c -> {
Encoder encoder = new Encoder(c);
drainInitialUpdate(encoder);
return encoder;
};
@@ -561,11 +562,11 @@
//
// https://tools.ietf.org/html/rfc7541#section-4.2
//
@Test
- public void seriesOfSizeUpdatesCustomEncoder() {
+ public void seriesOfSizeUpdatesCustomEncoder() throws IOException {
Function<Integer, Encoder> e = c -> {
Encoder encoder = newCustomEncoder(c);
drainInitialUpdate(encoder);
return encoder;
};
@@ -636,11 +637,11 @@
// updates - a sequence of values for consecutive calls to encoder.setMaxCapacity
// expected - a sequence of values expected to be decoded by a decoder
private void testSizeUpdate(Function<Integer, Encoder> encoder,
int initialSize,
List<Integer> updates,
- List<Integer> expected) {
+ List<Integer> expected) throws IOException {
Encoder e = encoder.apply(initialSize);
updates.forEach(e::setMaxCapacity);
ByteBuffer b = ByteBuffer.allocate(64);
e.header("a", "b");
e.encode(b);
< prev index next >