@Test public void testRst1() throws IOException { try (DataInputStream dataInputStream = streamSimulator.getDataInputStream(); DataOutputStream dataOutputStream = streamSimulator.getDataOutputStream()) { Protocol protocol = new Protocol(dataInputStream, dataOutputStream); streamSimulator.writeForInputStream("ROK 1 9"); protocol.ayt(); streamSimulator.writeForInputStream("ROK 0 "); ReceiveMessage receiveMessage = protocol.rst(); Assert.assertEquals(receiveMessage.getCommand(), Command.ROK); Assert.assertEquals(receiveMessage.getBody(), BYTES); Assert.assertEquals( streamSimulator.readLastFromOutputStream(), "RST 0 ".getBytes(StandardCharsets.UTF_8)); } catch (ProtocolStateException ignored) { Assert.fail(); } }