@Override
    public void close() throws IOException {
        super.close();
        closeSocket();
    }
@Test
    void testWriteMessage() throws Exception {
        try (ServerSocket ss = new ServerSocket(0);
             TcpServer tcpServer = new TcpServer(ss);
             ResilientSocketOutputStream resilientSocketOutputStream = new ResilientSocketOutputStream("localhost", ss.getLocalPort(), 1024, 500, SocketFactory.getDefault())) {
            Future<List<String>> receivedMessages = tcpServer.receive();
            resilientSocketOutputStream.write("Test message".getBytes(StandardCharsets.UTF_8));
            resilientSocketOutputStream.close();

            assertThat(receivedMessages.get(5, TimeUnit.SECONDS))
                .singleElement()
                .isEqualTo("Test message");
        }
    }