tmud-3.0.0/benchmark/
tmud-3.0.0/cmd/
tmud-3.0.0/cmd/objects/
tmud-3.0.0/cmd/tiny/
tmud-3.0.0/doc/SQLite/
tmud-3.0.0/doc/SQLite3/
tmud-3.0.0/doc/TernaryTrie/
tmud-3.0.0/farts/
tmud-3.0.0/lib/
tmud-3.0.0/lib/engine/
tmud-3.0.0/lib/farts/
tmud-3.0.0/logs/
#
# file::    mocksocket.rb
# author::  Jon A. Lambert
# version:: 2.6.0
# date::    10/06/2005
#
# This source code copyright (C) 2005 by Jon A. Lambert
# All rights reserved.
#
# Released under the terms of the TeensyMUD Public License
# See LICENSE file for additional information.
#

# A mocksocket spoofs the behavior of a TCPSocket for testing purposes
#
class MockSocket
  def initialize(data)
    @data = data
  end

  def recv(bufsize, flag=nil)
    @data.slice!(0...bufsize)
  end

  def send(msg, flag)
    msg.size
  end

  def close
    true
  end

  def peeraddr
    ["AF_INET", 8765, "users.house.net", "123.45.67.89"]
  end

  def addr
    ["AF_INET", 4000, "agamemnon", "10.0.0.2"]
  end

end