public void connectionclose() {
   try {
     is.close();
     os.close();
     dis.close();
     dos.close();
     sPort.close();
   } catch (Exception e) {
     System.out.println("close" + e);
   }
 }
  public void read(byte[] data) {
    try {
      is = port.getInputStream();
    } catch (IOException e) {
      System.err.println("IOException: " + e);
    }

    try {
      is.read(data);
    } catch (IOException e) {
      System.err.println("IOException: " + e);
    }
  }
  public void read() throws IOException {
    int i;
    int count = 0;
    byte[] packet = new byte[30];

    while ((i = in.read()) != -1) {
      if (count == 30) {
        System.out.println();
        count = 0;
        listener.packetReceived(packet);
      }
      System.out.print(Hex.toHex(i) + " ");
      packet[count] = (byte) i;
      count++;
    }
  }