< prev index next >
test/jdk/java/net/httpclient/http2/jdk.incubator.httpclient/jdk/incubator/http/internal/hpack/HuffmanTest.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2015, 2016, 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.
--- 1,7 ----
/*
! * Copyright (c) 2015, 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,31 ****
--- 22,33 ----
*/
package jdk.incubator.http.internal.hpack;
import org.testng.annotations.Test;
+ import java.io.IOException;
+ import java.io.UncheckedIOException;
import java.nio.ByteBuffer;
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
*** 300,310 ****
" (255) |11111111|11111111|11111011|10 3ffffee [26]\n" +
" EOS (256) |11111111|11111111|11111111|111111 3fffffff [30]";
// @formatter:on
@Test
! public void read_table() {
Pattern line = Pattern.compile(
"\\(\\s*(?<ascii>\\d+)\\s*\\)\\s*(?<binary>(\\|(0|1)+)+)\\s*" +
"(?<hex>[0-9a-zA-Z]+)\\s*\\[\\s*(?<len>\\d+)\\s*\\]");
Matcher m = line.matcher(SPEC);
int i = 0;
--- 302,312 ----
" (255) |11111111|11111111|11111011|10 3ffffee [26]\n" +
" EOS (256) |11111111|11111111|11111111|111111 3fffffff [30]";
// @formatter:on
@Test
! public void read_table() throws IOException {
Pattern line = Pattern.compile(
"\\(\\s*(?<ascii>\\d+)\\s*\\)\\s*(?<binary>(\\|(0|1)+)+)\\s*" +
"(?<hex>[0-9a-zA-Z]+)\\s*\\[\\s*(?<len>\\d+)\\s*\\]");
Matcher m = line.matcher(SPEC);
int i = 0;
*** 553,563 ****
--- 555,569 ----
}
private static void read(String hexdump, String decoded) {
ByteBuffer source = SpecHelper.toBytes(hexdump);
Appendable actual = new StringBuilder();
+ try {
new Huffman.Reader().read(source, actual, true);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
assertEquals(actual.toString(), decoded);
}
private static void write(String decoded, String hexdump) {
int n = Huffman.INSTANCE.lengthOf(decoded);
< prev index next >