@Test(expected = IOException.class)
public void inputStremException() throws CoapException, IOException {

    InputStream is = Mockito.mock(InputStream.class);
    when(is.read()).thenThrow(new IOException());
    CoapTcpPacketSerializer.deserialize(null, is);
}