@Override
	public Handshakedata translateHandshake( ByteBuffer buf ) throws InvalidHandshakeException {

		HandshakeBuilder bui = translateHandshakeHttp( buf, role );
		// the first drafts are lacking a protocol number which makes them difficult to distinguish. Sec-WebSocket-Key1 is typical for draft76
		if( ( bui.hasFieldValue( "Sec-WebSocket-Key1" ) || role == Role.CLIENT ) && !bui.hasFieldValue( "Sec-WebSocket-Version" ) ) {
			byte[] key3 = new byte[ role == Role.SERVER ? 8 : 16 ];
			try {
				buf.get( key3 );
			} catch ( BufferUnderflowException e ) {
				throw new IncompleteHandshakeException( buf.capacity() + 16 );
			}
			bui.setContent( key3 );

		}
		return bui;
	}