Automatic adaptor synthesis for protocol transformation