func (hr *HttpReceiver) B3Stop() error {
	return hr.b3Server.stop()
}
B3Stop stops the underlying HTTP Server using B3 Propagation.
package testservice
import (
	"context"
	"fmt"
	"sync"
	"time"
	"github.com/golang/protobuf/proto"
	"github.com/gorilla/mux"
	"go.opencensus.io/plugin/ochttp"
	"go.opencensus.io/plugin/ochttp/propagation/b3"
	"go.opencensus.io/plugin/ochttp/propagation/tracecontext"
	"go.opencensus.io/trace/propagation"
	"goservice/genproto"
	"io/ioutil"
	"net/http"
)
type httpServer struct {
	mu     sync.Mutex
	server *http.Server
	stopOnce              sync.Once
	startServerOnce       sync.Once
	startRegistrationOnce sync.Once
}
type HttpReceiver struct {
	b3Server httpServer
	tcServer httpServer
}
func newHttpHandler(propagation propagation.HTTPFormat) http.Handler {
	r := mux.NewRouter()
	r.HandleFunc("/test/request", httpTestRequestHandler)
	var h http.Handler = r
	h = &ochttp.Handler{  
		Handler:     h,
		Propagation: propagation}
	return h
}
func newB3Server(b3Addr string) httpServer {
	return httpServer{server: &http.Server{Addr: b3Addr, Handler: newHttpHandler(&b3.HTTPFormat{})}}
}
func newTcServer(tcAddr string) httpServer {
	return httpServer{server: &http.Server{Addr: tcAddr, Handler: newHttpHandler(&tracecontext.HTTPFormat{})}}
}
func NewHttpReceiver(b3Addr, tcAddr string) *HttpReceiver {
	return &HttpReceiver{b3Server: newB3Server(b3Addr), tcServer: newTcServer(tcAddr)}
}
func httpTestRequestHandler(w http.ResponseWriter, req *http.Request) {
	data, err := ioutil.ReadAll(req.Body)
	if err != nil {
		return
	}
	var rp *RequestProcessor
	testRequest := interop.TestRequest{}
	if err := proto.Unmarshal(data, &testRequest); err == nil {
		testResp, _ := rp.getInstance().process(req.Context(), &testRequest)
		data, err := proto.Marshal(testResp)
		if err != nil {
			http.Error(w, fmt.Sprintf("error marshalling response %s", err.Error()), http.StatusInternalServerError)
		} else {
			w.Write(data)
		}
	} else {
		http.Error(w, "error parsing request", http.StatusBadRequest)
	}
}
func (hr *HttpReceiver) B3Start(ctx context.Context) error {
	return hr.b3Server.start(ctx)
}