def METHOD_NAME(self, context, payload):
    """
    Write the current buffer and return the response.
    """
    # construct headers for request
    request_headers = {}
    if self._get_request_headers is not None:
        request_headers = self._get_request_headers(context)
    # apply the default headers so their values cannot be modified
    request_headers.update(self._headers)
    self._preflight_request_check(payload)
    encoded = base64.b64encode(payload)
    METHOD_NAME = HTTPRequest(self._url,
                          method='POST',
                          body=encoded,
                          headers=request_headers,
                          request_timeout=context.timeout / 1000.0
                          )
    try:
        response = yield self._http.fetch(METHOD_NAME)
    except HTTPError as e:
        if e.code == httplib.REQUEST_ENTITY_TOO_LARGE:
            raise TTransportException(
                type=TTransportExceptionType.RESPONSE_TOO_LARGE,
                message='response was too large')
        # Tornado HttpClient uses 599 as the HTTP code to indicate a
        # request timeout
        if e.code == 599:
            raise TTransportException(
                type=TTransportExceptionType.TIMED_OUT,
                message='request timed out')
        message = 'response errored with code {0} and body {1}'.format(
            e.code, e.message
        )
        raise TTransportException(
            type=TTransportExceptionType.UNKNOWN,
            message=message)
    except socket.gaierror as e:
        raise TTransportException(
            type=TTransportExceptionType.SERVICE_NOT_AVAILABLE,
            message='service not available: {}'.format(e.strerror)
        )
    decoded = base64.b64decode(response.body)
    if len(decoded) < 4:
        raise TTransportException(
            type=TTransportExceptionType.UNKNOWN,
            message='invalid frame size')
    if len(decoded) == 4:
        # One-way method, drop response
        return
    raise gen.Return(TMemoryBuffer(decoded[4:]))