本文整理汇总了Java中java.net.ProtocolException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java ProtocolException.getMessage方法的具体用法?Java ProtocolException.getMessage怎么用?Java ProtocolException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.net.ProtocolException
的用法示例。
在下文中一共展示了ProtocolException.getMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeReservedSetThrows
import java.net.ProtocolException; //导入方法依赖的package包/类
@Test public void closeReservedSetThrows() throws IOException {
data.write(ByteString.decodeHex("880203ec")); // Close with code 1004
data.write(ByteString.decodeHex("880203ed")); // Close with code 1005
data.write(ByteString.decodeHex("880203ee")); // Close with code 1006
for (int i = 1012; i <= 2999; i++) {
data.write(ByteString.decodeHex("8802" + Util.format("%04X", i))); // Close with code 'i'
}
int count = 0;
for (; !data.exhausted(); count++) {
try {
clientReader.processNextFrame();
fail();
} catch (ProtocolException e) {
String message = e.getMessage();
assertTrue(message, Pattern.matches("Code \\d+ is reserved and may not be used.", message));
}
}
assertEquals(1991, count);
}