code: func NewMockSocket(fileName string) (*MockSocket, error) {
  	socket := &MockSocket{receivedMessages: make(chan json.RawMessage, 100), expectedRequests: make(chan *mocksocketRequest, 10000), closed: make(chan struct{})}
  	if fileName != "" {
  		var lastRequest *mocksocketRequest
  		messages := readTrafficLog(fileName)
  		for _, m := range messages {
  			if m.Sent != nil {
  				lastRequest = &mocksocketRequest{sentMessage: m.Sent}
  				socket.expectedRequests <- lastRequest
  			} else if m.Received != nil {
  				if lastRequest == nil {
  					// When no request have been sent then push the received messages straight to the receivedMessage channel
  					socket.receivedMessages <- m.Received
  				} else {
  					// When a request has been sent then add the responses to that request
  					lastRequest.responses = append(lastRequest.responses, m.Received)
  				}
  
  			}
  		}
  	}
  	return socket, nil
  }
docs: // NewMockSocket creates a new MockSocket instance