diff --git a/pkg/server/server.go b/pkg/server/server.go
index ae59fe5c0a2561eb95412e8ecb07d1f0cbed6ab8..bbebdefdbd7902f52feeccb4e6587a7073d35ad2 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -176,6 +176,18 @@ func (s *Server) ServeCodec(pctx context.Context, remote codec.ReaderWriter) {
 	}
 }
 
+// Stop stops reading new requests, waits for stopPendingRequestTimeout to allow pending
+// requests to finish, then closes all codecs which will cancel pending requests and
+// subscriptions.
+func (s *Server) Stop() {
+	if atomic.CompareAndSwapInt32(&s.run, 1, 0) {
+		s.codecs.Each(func(c any) bool {
+			c.(codec.ReaderWriter).Close()
+			return true
+		})
+	}
+}
+
 type callResponder struct {
 	toSend   chan *callEnv
 	toNotify chan *notifyEnv
@@ -298,16 +310,16 @@ func (c *callResponder) send(ctx context.Context, env *callEnv) error {
 	return nil
 }
 
-type callEnv struct {
-	responses []*callRespWriter
-	batch     bool
-}
-
 type notifyEnv struct {
 	method string
 	dat    func(io.Writer) error
 }
 
+type callEnv struct {
+	responses []*callRespWriter
+	batch     bool
+}
+
 var _ codec.ResponseWriter = (*callRespWriter)(nil)
 
 type callRespWriter struct {
@@ -349,29 +361,3 @@ func (c *callRespWriter) Notify(method string, v any) error {
 	}
 	return nil
 }
-
-// Stop stops reading new requests, waits for stopPendingRequestTimeout to allow pending
-// requests to finish, then closes all codecs which will cancel pending requests and
-// subscriptions.
-func (s *Server) Stop() {
-	if atomic.CompareAndSwapInt32(&s.run, 1, 0) {
-		s.codecs.Each(func(c any) bool {
-			c.(codec.ReaderWriter).Close()
-			return true
-		})
-	}
-}
-
-type peerInfoContextKey struct{}
-
-// PeerInfoFromContext returns information about the client's network connection.
-// Use this with the context passed to RPC method handler functions.
-//
-// The zero value is returned if no connection info is present in ctx.
-func PeerInfoFromContext(ctx context.Context) codec.PeerInfo {
-	info, _ := ctx.Value(peerInfoContextKey{}).(codec.PeerInfo)
-	return info
-}
-func ContextWithPeerInfo(ctx context.Context, c codec.PeerInfo) context.Context {
-	return context.WithValue(ctx, peerInfoContextKey{}, c)
-}
diff --git a/pkg/server/util.go b/pkg/server/util.go
new file mode 100644
index 0000000000000000000000000000000000000000..796482efd45bdf0bd332e541fd08fc01c20fbddf
--- /dev/null
+++ b/pkg/server/util.go
@@ -0,0 +1,21 @@
+package server
+
+import (
+	"context"
+
+	"gfx.cafe/open/jrpc/pkg/codec"
+)
+
+type peerInfoContextKey struct{}
+
+// PeerInfoFromContext returns information about the client's network connection.
+// Use this with the context passed to RPC method handler functions.
+//
+// The zero value is returned if no connection info is present in ctx.
+func PeerInfoFromContext(ctx context.Context) codec.PeerInfo {
+	info, _ := ctx.Value(peerInfoContextKey{}).(codec.PeerInfo)
+	return info
+}
+func ContextWithPeerInfo(ctx context.Context, c codec.PeerInfo) context.Context {
+	return context.WithValue(ctx, peerInfoContextKey{}, c)
+}