code: private void prepareStreams(Socket socket) throws IOException {
  
          // Close any open streams if I'm being called because a new socket was
          // set to handle this transport.
          try {
              if (dataInputStream != null) {
                  dataInputStream.close();
              }
              if (dataOutputStream != null) {
                  dataOutputStream.close();
              }
          }
          catch (IOException x) {
              // Do nothing.
          }
  
          dataInputStream = new DataInputStream(new BufferedInputStream(socket.getInputStream()));
          dataOutputStream = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream()));
      }
docs: Prepares the input and output streams of this <tt>ModbusTCPTransport</tt>
  instance based on the given socket.
  
  @param socket the socket used for communications.
  
  @throws IOException if an I/O related error occurs.