TlsAttackerSocket { public void send(String string) { send(string.getBytes(Charset.defaultCharset())); } TlsAttackerSocket(State state); void sendRawBytes(byte[] bytes); byte[] receiveRawBytes(); void send(String string); void send(byte[] bytes); byte[] receiveBytes(); String receiveString(); void send(ProtocolMessage message); void close();  }
@Test public void testSend_String() throws IOException { socket.send("test"); byte[] sentBytes = transportHandler.getSendByte(); assertArrayEquals( sentBytes, ArrayConverter.concatenate(new byte[] { 0x17, 0x03, 0x03, 0x00, 0x04 }, "test".getBytes(Charset.forName("ASCII")))); }
@Test public void testSend_byteArr() { socket.send(new byte[] { 0, 1, 2, 3 }); byte[] sentBytes = transportHandler.getSendByte(); assertArrayEquals(sentBytes, new byte[] { 0x17, 0x03, 0x03, 0x00, 0x04, 0, 1, 2, 3 }); }