code: func (c *Client) writeBlock(data []byte) (int, error) {
  	ss, err := c.streamSizes()
  	if err != nil {
  		return 0, err
  	}
  	// TODO: maybe make this buffer (and header and trailer buffers) part of Context struct
  	var b [4]sspi.SecBuffer
  	b[0].Set(sspi.SECBUFFER_STREAM_HEADER, make([]byte, ss.Header))
  	b[1].Set(sspi.SECBUFFER_DATA, data)
  	b[2].Set(sspi.SECBUFFER_STREAM_TRAILER, make([]byte, ss.Trailer))
  	b[3].Set(sspi.SECBUFFER_EMPTY, nil)
  	ret := sspi.EncryptMessage(c.ctx.Handle, 0, sspi.NewSecBufferDesc(b[:]), 0)
  	switch ret {
  	case sspi.SEC_E_OK:
  	case sspi.SEC_E_CONTEXT_EXPIRED:
  		// TODO: handle this
  		panic("writeBlock: SEC_E_CONTEXT_EXPIRED")
  	default:
  		return 0, ret
  	}
  	n1, err := b[0].WriteAll(c.conn)
  	if err != nil {
  		return n1, err
  	}
  	n2, err := b[1].WriteAll(c.conn)
  	if err != nil {
  		return n1 + n2, err
  	}
  	n3, err := b[2].WriteAll(c.conn)
  	return n1 + n2 + n3, err
  }
docs: // TODO: protect Handshake, Read, Write and Shutdown with locks
  // TODO: call Handshake at the start Read and Write unless handshake is already complete