private void validateSendMessage0(byte[] msg,OutputStream out,InputStream in) throws Exception {
  out.write(msg);
  byte[] res=new byte[MSG_SIZE];
  int rcvd=0;
  while (rcvd < res.length) {
    int cnt=in.read(res,rcvd,res.length - rcvd);
    if (cnt == -1)     fail("Server closed connection before echo reply was fully sent");
    rcvd+=cnt;
  }
  assertEquals(msg.length,res.length);
  for (int i=0; i < msg.length; i++)   assertEquals("Mismatch in position " + i,msg[i],res[i]);
}

private void validateSendMessage0 ( byte [ ] msg , OutputStream out , InputStream in ) throws Exception { out . write ( msg ) ; byte [ ] res = new byte [ MSG_SIZE ] ; int rcvd = 0 ; while ( rcvd < res . length ) { int cnt = in . read ( res , rcvd , res . length - rcvd ) ; if ( cnt == - 1 ) fail ( "Server closed connection before echo reply was fully sent" ) ; rcvd += cnt ; } assertEquals ( msg . length , res . length ) ; for ( int i = 0 ; i < msg . length ; i ++ ) assertEquals ( "Mismatch in position " + i , msg [ i ] , res [ i ] ) ; }
sends message and validates reply .
