@Test(expected = EOFException.class) public void testDecodeWithLongerFrame() throws EOFException { byte[] raw = new byte[] { 1, 0, 0, 0, 0, 0, 0, 4, 98, 105, 110, 10, 110 }; DockerStreamUtil.decodeFullRawResponse(raw); }
} else if (rawBody instanceof byte[]) { try { output = DockerStreamUtil.decodeFullRawResponse((byte[]) rawBody); } catch (Exception decodeEx) { logger.severe(decodeEx.getMessage());
@Test public void testDecodePartialResponse() throws EOFException { byte[] raw = new byte[] { 1, 0, 0, 0, 0, 0, 0, 4, 98, 105, 110, 10 }; String decoded = DockerStreamUtil.decodeFullRawResponse(raw); String expected = "bin\n"; assertEquals(expected, decoded); }
@Test(expected = EOFException.class) public void testDecodeWithShorterFrame() throws EOFException { byte[] raw = new byte[] { 1, 0, 0, 0, 0, 0, 0, 4, 98, 105, 110 }; DockerStreamUtil.decodeFullRawResponse(raw); fail("expected to throw exception"); }
115, 115, 10 }; String decoded = DockerStreamUtil.decodeFullRawResponse(raw);