private void writeChunks(SocketChannel channel,byte[] bytes,int length){
synchronized (channel) {
    byte[] buff=new byte[length];
    System.arraycopy(bytes,0,buff,0,length);
    messageProcessor.send(channel,bytes);
  }
}

private void writeChunks ( SocketChannel channel , byte [ ] bytes , int length ) { synchronized ( channel ) { byte [ ] buff = new byte [ length ] ; System . arraycopy ( bytes , 0 , buff , 0 , length ) ; messageProcessor . send ( channel , bytes ) ; } }
a private function to write things out . this needs to be synchronized as writes can occur from multiple threads . we write in chunks to allow the other side to synchronize for large sized writes .
