func (mux *ServeMux) Handle(pattern string, handler Handler) {
	for pattern != "" && pattern[0] == '/' {
		pattern = pattern[1:]
	}
	if pattern == "" {
		panic("http: invalid pattern " + pattern)
	}
	if handler == nil {
		panic("http: nil handler")
	}
	mux.m[pattern] = muxEntry{h: handler, pattern: pattern}
}
Handle configures a handler for the given path.
package coap
import (
	"net"
)
type ServeMux struct {
	m map[string]muxEntry
}
type muxEntry struct {
	h       Handler
	pattern string
}
func NewServeMux() *ServeMux { return &ServeMux{m: make(map[string]muxEntry)} }
func pathMatch(pattern, path string) bool {
	if len(pattern) == 0 {
		return false
	}
	n := len(pattern)
	if pattern[n-1] != '/' {
		return pattern == path
	}
	return len(path) >= n && path[0:n] == pattern
}
func (mux *ServeMux) match(path string) (h Handler, pattern string) {
	var n = 0
	for k, v := range mux.m {
		if !pathMatch(k, path) {
			continue
		}
		if h == nil || len(k) > n {
			n = len(k)
			h = v.h
			pattern = v.pattern
		}
	}
	return
}
func notFoundHandler(l *net.UDPConn, a *net.UDPAddr, m *Message) *Message {
	if m.IsConfirmable() {
		return &Message{
			Type: Acknowledgement,
			Code: NotFound,
		}
	}
	return nil
}
var _ = Handler(&ServeMux{})
func (mux *ServeMux) ServeCOAP(l *net.UDPConn, a *net.UDPAddr, m *Message) *Message {
	h, _ := mux.match(m.PathString())
	if h == nil {
		h, _ = funcHandler(notFoundHandler), ""
	}
	return h.ServeCOAP(l, a, m)
}