There are many ways to do this, as described in https://www.relishapp.com/rspec/rspec-mocks/v/3-0/docs. They vary in terms of syntax and the extent to which they constrain the execution.
One of the most permissive approaches would be to include the following prior to your get
call:
server = double('server').as_null_object
TCPSocket.stub(:new).and_return(server)
This would permit/ignore any arguments passed to TCPSocket.new
and ignore all messages/arguments passed to object returned from that call.