    # File lib/phusion_passenger/message_channel.rb, line 100
            def read
                    buffer = new_buffer
                    if !@io.read(HEADER_SIZE, buffer)
                            return nil
                    end
                    while buffer.size < HEADER_SIZE
                            tmp = @io.read(HEADER_SIZE - buffer.size)
                            if tmp.empty?
                                    return nil
                            else
                                    buffer << tmp
                            end
                    end

                    chunk_size = buffer.unpack(UINT16_PACK_FORMAT)[0]
                    if !@io.read(chunk_size, buffer)
                            return nil
                    end
                    while buffer.size < chunk_size
                            tmp = @io.read(chunk_size - buffer.size)
                            if tmp.empty?
                                    return nil
                            else
                                    buffer << tmp
                            end
                    end

                    message = []
                    offset = 0
                    delimiter_pos = buffer.index(DELIMITER, offset)
                    while !delimiter_pos.nil?
                            if delimiter_pos == 0
                                    message << ""
                            else
                                    message << buffer[offset .. delimiter_pos - 1]
                            end
                            offset = delimiter_pos + 1
                            delimiter_pos = buffer.index(DELIMITER, offset)
                    end
                    return message
            rescue Errno::ECONNRESET
                    return nil
            end