### Question:
HEXChannel extends BaseChannel { protected void sendMessageLength(int len) throws IOException { if (len > 0xFFFF) throw new IOException (len + " exceeds maximum length"); try { serverOut.write ( ISOUtil.zeropad (Integer.toString (len % 0xFFFF,16), 4).getBytes() ); } catch (ISOException e) { Logger.log (new LogEvent (this, "send-message-length", e)); } } HEXChannel();  HEXChannel(String host, int port, ISOPackager p, byte[] TPDU);  HEXChannel(ISOPackager p, byte[] TPDU);  HEXChannel(ISOPackager p, byte[] TPDU, ServerSocket serverSocket);   }### Answer:
@Test public void testSendMessageLengthThrowsNullPointerException() throws Throwable { HEXChannel hEXChannel = new HEXChannel(new ISOBaseValidatingPackager(), null, new ServerSocket()); try { hEXChannel.sendMessageLength(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.DataOutputStream.write(byte[])\" because \"this.serverOut\" is null", ex.getMessage(), "ex.getMessage()"); } } }