Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tcp_connection_for_testing.h
Go to the documentation of this file.
1 // Copyright 2016 Google Inc.
16 
17 #ifndef PAGESPEED_SYSTEM_TCP_CONNECTION_FOR_TESTING_H_
18 #define PAGESPEED_SYSTEM_TCP_CONNECTION_FOR_TESTING_H_
19 
20 #include "apr_pools.h"
21 #include "apr_network_io.h"
25 
26 namespace net_instaweb {
27 
32  public:
35 
36  bool Connect(const GoogleString& hostname, int port);
37 
38  void Send(StringPiece data);
39 
41  GoogleString ReadBytes(int length);
42 
45  return ReadUntil("\n");
46  }
47 
50  return ReadUntil("\r\n");
51  }
52 
54  GoogleString ReadUntil(StringPiece marker);
55 
56  private:
57  apr_pool_t* pool_;
58  apr_socket_t* socket_;
59 
60 
61 };
62 
63 }
64 
65 #endif
Definition: tcp_connection_for_testing.h:31
GoogleString ReadBytes(int length)
Reads specific amount of bytes, fais if EOF happens before.
GoogleString ReadLine()
LF is included unless EOF happened before it.
Definition: tcp_connection_for_testing.h:44
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
GoogleString ReadUntil(StringPiece marker)
Returns data read, marker is included unless EOF happened before it.
GoogleString ReadLineCrLf()
CRLF is included unless EOF happened before it.
Definition: tcp_connection_for_testing.h:49