TlsAttackerSocket { public String receiveString() throws IOException { return new String(receiveBytes(), 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 testReceiveString() throws Exception { transportHandler.setFetchableByte(ArrayConverter.concatenate(new byte[] { 0x17, 0x03, 0x03, 0x00, 0x04 }, "test".getBytes(Charset.forName("ASCII")))); String receivedString = socket.receiveString(); assertEquals("test", receivedString); }