@Test public void testReadHeaderThrowsNullPointerException() throws Throwable { VAPChannel vAPChannel = new VAPChannel(); try { vAPChannel.readHeader(100); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"java.io.DataInputStream.read()\" because \"this.serverIn\" is null", ex.getMessage(), "ex.getMessage()"); } } }
protected byte[] readHeader(int hLen) throws IOException { int b = serverIn.read(); int bytesRead = b; if (b != -1) { byte bytes[] = new byte[b]; bytes[0] = (byte) b; serverIn.readFully(bytes, 1, b - 1); if ((bytes[1] & 0x80) == 0x80) { b = serverIn.read(); bytesRead += b; byte tmp[] = new byte[bytesRead]; System.arraycopy(bytes, 0, tmp, 0, bytes.length); tmp[bytes.length] = (byte) b; serverIn.readFully(tmp, bytes.length + 1, b - 1); bytes = tmp; } return bytes; } else { throw new IOException("Error reading header"); } }
VAPChannel extends BaseChannel { protected byte[] readHeader(int hLen) throws IOException { int b = serverIn.read(); int bytesRead = b; if (b != -1) { byte bytes[] = new byte[b]; bytes[0] = (byte) b; serverIn.readFully(bytes, 1, b - 1); if ((bytes[1] & 0x80) == 0x80) { b = serverIn.read(); bytesRead += b; byte tmp[] = new byte[bytesRead]; System.arraycopy(bytes, 0, tmp, 0, bytes.length); tmp[bytes.length] = (byte) b; serverIn.readFully(tmp, bytes.length + 1, b - 1); bytes = tmp; } return bytes; } else { throw new IOException("Error reading header"); } } }
VAPChannel extends BaseChannel { protected byte[] readHeader(int hLen) throws IOException { int b = serverIn.read(); int bytesRead = b; if (b != -1) { byte bytes[] = new byte[b]; bytes[0] = (byte) b; serverIn.readFully(bytes, 1, b - 1); if ((bytes[1] & 0x80) == 0x80) { b = serverIn.read(); bytesRead += b; byte tmp[] = new byte[bytesRead]; System.arraycopy(bytes, 0, tmp, 0, bytes.length); tmp[bytes.length] = (byte) b; serverIn.readFully(tmp, bytes.length + 1, b - 1); bytes = tmp; } return bytes; } else { throw new IOException("Error reading header"); } } VAPChannel();  VAPChannel(String host, int port, ISOPackager p);  VAPChannel(ISOPackager p);  VAPChannel(ISOPackager p, ServerSocket serverSocket); }
VAPChannel extends BaseChannel { protected byte[] readHeader(int hLen) throws IOException { int b = serverIn.read(); int bytesRead = b; if (b != -1) { byte bytes[] = new byte[b]; bytes[0] = (byte) b; serverIn.readFully(bytes, 1, b - 1); if ((bytes[1] & 0x80) == 0x80) { b = serverIn.read(); bytesRead += b; byte tmp[] = new byte[bytesRead]; System.arraycopy(bytes, 0, tmp, 0, bytes.length); tmp[bytes.length] = (byte) b; serverIn.readFully(tmp, bytes.length + 1, b - 1); bytes = tmp; } return bytes; } else { throw new IOException("Error reading header"); } } VAPChannel();  VAPChannel(String host, int port, ISOPackager p);  VAPChannel(ISOPackager p);  VAPChannel(ISOPackager p, ServerSocket serverSocket); void setSrcId(String srcid); String getSrcId(); void setDstId(String dstid); String getDstId(); void send(ISOMsg m); void setConfiguration(Configuration cfg); }
VAPChannel extends BaseChannel { protected byte[] readHeader(int hLen) throws IOException { int b = serverIn.read(); int bytesRead = b; if (b != -1) { byte bytes[] = new byte[b]; bytes[0] = (byte) b; serverIn.readFully(bytes, 1, b - 1); if ((bytes[1] & 0x80) == 0x80) { b = serverIn.read(); bytesRead += b; byte tmp[] = new byte[bytesRead]; System.arraycopy(bytes, 0, tmp, 0, bytes.length); tmp[bytes.length] = (byte) b; serverIn.readFully(tmp, bytes.length + 1, b - 1); bytes = tmp; } return bytes; } else { throw new IOException("Error reading header"); } } VAPChannel();  VAPChannel(String host, int port, ISOPackager p);  VAPChannel(ISOPackager p);  VAPChannel(ISOPackager p, ServerSocket serverSocket); void setSrcId(String srcid); String getSrcId(); void setDstId(String dstid); String getDstId(); void send(ISOMsg m); void setConfiguration(Configuration cfg);  }