Simplify higher-level socket interfaces

Where we previously had StreamClientSocket (with connect/disconnect) built on top of Socket (with receive/send), merge into a single ConnectingClientSocket.  I think this works better for two reasons:
1) Nothing in StreamClientSocket was particular to a streaming protocol.  The interface is just as applicable for stuff like "connected" UDP sockets.
2) The undirected Send/Receive previously in Socket make more sense for a connected socket whereas an unconnected socket is more likely to make use of SendTo/ReceiveFrom.  Maybe undirected Receive is useful for both, but that's an issue that can be figured out if/when we ever add unconnected socket support in these interfaces.

Naming note: My initial instinct is to call a connection-oriented client socket `ConnectedClientSocket`, but I decided to go with `ConnectingClientSocket` instead to avoid confusion with it referring to a socket that has already been connected.

PiperOrigin-RevId: 471878943
diff --git a/build/source_list.bzl b/build/source_list.bzl
index 55336fa..f652020 100644
--- a/build/source_list.bzl
+++ b/build/source_list.bzl
@@ -954,6 +954,7 @@
     "quic/core/batch_writer/quic_batch_writer_test.h",
     "quic/core/batch_writer/quic_gso_batch_writer.h",
     "quic/core/batch_writer/quic_sendmmsg_batch_writer.h",
+    "quic/core/io/connecting_client_socket.h",
     "quic/core/io/event_loop_socket_factory.h",
     "quic/core/io/event_loop_tcp_client_socket.h",
     "quic/core/io/quic_default_event_loop.h",
@@ -961,7 +962,6 @@
     "quic/core/io/quic_poll_event_loop.h",
     "quic/core/io/socket.h",
     "quic/core/io/socket_factory.h",
-    "quic/core/io/stream_client_socket.h",
     "quic/core/quic_default_packet_writer.h",
     "quic/core/quic_epoll_alarm_factory.h",
     "quic/core/quic_epoll_clock.h",
diff --git a/build/source_list.gni b/build/source_list.gni
index 802b493..0b8adf2 100644
--- a/build/source_list.gni
+++ b/build/source_list.gni
@@ -954,6 +954,7 @@
     "src/quiche/quic/core/batch_writer/quic_batch_writer_test.h",
     "src/quiche/quic/core/batch_writer/quic_gso_batch_writer.h",
     "src/quiche/quic/core/batch_writer/quic_sendmmsg_batch_writer.h",
+    "src/quiche/quic/core/io/connecting_client_socket.h",
     "src/quiche/quic/core/io/event_loop_socket_factory.h",
     "src/quiche/quic/core/io/event_loop_tcp_client_socket.h",
     "src/quiche/quic/core/io/quic_default_event_loop.h",
@@ -961,7 +962,6 @@
     "src/quiche/quic/core/io/quic_poll_event_loop.h",
     "src/quiche/quic/core/io/socket.h",
     "src/quiche/quic/core/io/socket_factory.h",
-    "src/quiche/quic/core/io/stream_client_socket.h",
     "src/quiche/quic/core/quic_default_packet_writer.h",
     "src/quiche/quic/core/quic_epoll_alarm_factory.h",
     "src/quiche/quic/core/quic_epoll_clock.h",
diff --git a/build/source_list.json b/build/source_list.json
index ea2cf5e..1b2e8e4 100644
--- a/build/source_list.json
+++ b/build/source_list.json
@@ -953,6 +953,7 @@
     "quiche/quic/core/batch_writer/quic_batch_writer_test.h",
     "quiche/quic/core/batch_writer/quic_gso_batch_writer.h",
     "quiche/quic/core/batch_writer/quic_sendmmsg_batch_writer.h",
+    "quiche/quic/core/io/connecting_client_socket.h",
     "quiche/quic/core/io/event_loop_socket_factory.h",
     "quiche/quic/core/io/event_loop_tcp_client_socket.h",
     "quiche/quic/core/io/quic_default_event_loop.h",
@@ -960,7 +961,6 @@
     "quiche/quic/core/io/quic_poll_event_loop.h",
     "quiche/quic/core/io/socket.h",
     "quiche/quic/core/io/socket_factory.h",
-    "quiche/quic/core/io/stream_client_socket.h",
     "quiche/quic/core/quic_default_packet_writer.h",
     "quiche/quic/core/quic_epoll_alarm_factory.h",
     "quiche/quic/core/quic_epoll_clock.h",
diff --git a/quiche/quic/core/io/connecting_client_socket.h b/quiche/quic/core/io/connecting_client_socket.h
new file mode 100644
index 0000000..930300b
--- /dev/null
+++ b/quiche/quic/core/io/connecting_client_socket.h
@@ -0,0 +1,107 @@
+// Copyright 2022 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef QUICHE_QUIC_CORE_IO_CONNECTING_CLIENT_SOCKET_H_
+#define QUICHE_QUIC_CORE_IO_CONNECTING_CLIENT_SOCKET_H_
+
+#include <string>
+
+#include "absl/status/status.h"
+#include "absl/status/statusor.h"
+#include "quiche/common/platform/api/quiche_export.h"
+#include "quiche/common/platform/api/quiche_mem_slice.h"
+#include "quiche/quic/core/quic_types.h"
+
+namespace quic {
+
+// A client socket that provides connection-based send/receive. In the case of
+// protocols like UDP, may only be a pseudo-connection that doesn't actually
+// affect the underlying network protocol.
+//
+// Must not destroy a connected/connecting socket. If connected or connecting,
+// must call Disconnect() to disconnect or cancel the connection before
+// destruction.
+//
+// Warning regarding blocking calls: Code in the QUICHE library typically
+// handles IO on a single thread, so if making calls from that typical
+// environment, it would be problematic to make a blocking call and block that
+// single thread.
+class QUICHE_EXPORT_PRIVATE ConnectingClientSocket {
+ public:
+  class AsyncVisitor {
+   public:
+    virtual ~AsyncVisitor() = default;
+
+    virtual void ConnectComplete(absl::Status status) = 0;
+
+    // If the operation completed without error, `data` is set to the received
+    // data.
+    virtual void ReceiveComplete(
+        absl::StatusOr<quiche::QuicheMemSlice> data) = 0;
+
+    virtual void SendComplete(absl::Status status) = 0;
+  };
+
+  virtual ~ConnectingClientSocket() = default;
+
+  // Establishes a connection synchronously. Should not be called if socket has
+  // already been successfully connected without first calling Disconnect().
+  //
+  // After calling, the socket must not be destroyed until Disconnect() is
+  // called.
+  virtual absl::Status ConnectBlocking() = 0;
+
+  // Establishes a connection asynchronously. On completion, calls
+  // ConnectComplete() on the visitor, potentially before return from
+  // ConnectAsync(). Should not be called if socket has already been
+  // successfully connected without first calling Disconnect().
+  //
+  // After calling, the socket must not be destroyed until Disconnect() is
+  // called.
+  virtual void ConnectAsync() = 0;
+
+  // Disconnects a connected socket or cancels an in-progress ConnectAsync(),
+  // invoking the `ConnectComplete(absl::CancelledError())` on the visitor.
+  // After success, it is possible to call ConnectBlocking() or ConnectAsync()
+  // again to establish a new connection. Cancels any pending read or write
+  // operations, calling visitor completion methods with
+  // `absl::CancelledError()`.
+  //
+  // Typically implemented via a call to ::close(), which for TCP can result in
+  // either FIN or RST, depending on socket/platform state and undefined
+  // platform behavior.
+  virtual void Disconnect() = 0;
+
+  // Blocking read. Receives and returns a buffer of up to `max_size` bytes from
+  // socket. Returns status on error.
+  virtual absl::StatusOr<quiche::QuicheMemSlice> ReceiveBlocking(
+      QuicByteCount max_size) = 0;
+
+  // Asynchronous read. Receives up to `max_size` bytes from socket. If
+  // no data is synchronously available to be read, waits until some data is
+  // available or the socket is closed. On completion, calls ReceiveComplete()
+  // on the visitor, potentially before return from ReceiveAsync().
+  //
+  // After calling, the socket must not be destroyed until ReceiveComplete() is
+  // called.
+  virtual void ReceiveAsync(QuicByteCount max_size) = 0;
+
+  // Blocking write. Sends all of `data` (potentially via multiple underlying
+  // socket sends).
+  virtual absl::Status SendBlocking(std::string data) = 0;
+  virtual absl::Status SendBlocking(quiche::QuicheMemSlice data) = 0;
+
+  // Asynchronous write. Sends all of `data` (potentially via multiple
+  // underlying socket sends). On completion, calls SendComplete() on the
+  // visitor, potentially before return from SendAsync().
+  //
+  // After calling, the socket must not be destroyed until SendComplete() is
+  // called.
+  virtual void SendAsync(std::string data) = 0;
+  virtual void SendAsync(quiche::QuicheMemSlice data) = 0;
+};
+
+}  // namespace quic
+
+#endif  // QUICHE_QUIC_CORE_IO_CONNECTING_CLIENT_SOCKET_H_
diff --git a/quiche/quic/core/io/event_loop_socket_factory.cc b/quiche/quic/core/io/event_loop_socket_factory.cc
index 4d2508e..b403c6b 100644
--- a/quiche/quic/core/io/event_loop_socket_factory.cc
+++ b/quiche/quic/core/io/event_loop_socket_factory.cc
@@ -6,9 +6,9 @@
 
 #include <memory>
 
+#include "quiche/quic/core/io/connecting_client_socket.h"
 #include "quiche/quic/core/io/event_loop_tcp_client_socket.h"
 #include "quiche/quic/core/io/quic_event_loop.h"
-#include "quiche/quic/core/io/stream_client_socket.h"
 #include "quiche/quic/core/quic_types.h"
 #include "quiche/quic/platform/api/quic_socket_address.h"
 #include "quiche/common/platform/api/quiche_logging.h"
@@ -23,11 +23,11 @@
   QUICHE_DCHECK(buffer_allocator_);
 }
 
-std::unique_ptr<StreamClientSocket>
+std::unique_ptr<ConnectingClientSocket>
 EventLoopSocketFactory::CreateTcpClientSocket(
     const quic::QuicSocketAddress& peer_address,
     QuicByteCount receive_buffer_size, QuicByteCount send_buffer_size,
-    StreamClientSocket::AsyncVisitor* async_visitor) {
+    ConnectingClientSocket::AsyncVisitor* async_visitor) {
   return std::make_unique<EventLoopTcpClientSocket>(
       peer_address, receive_buffer_size, send_buffer_size, event_loop_,
       buffer_allocator_, async_visitor);
diff --git a/quiche/quic/core/io/event_loop_socket_factory.h b/quiche/quic/core/io/event_loop_socket_factory.h
index 6882e80..03ab856 100644
--- a/quiche/quic/core/io/event_loop_socket_factory.h
+++ b/quiche/quic/core/io/event_loop_socket_factory.h
@@ -7,9 +7,9 @@
 
 #include <memory>
 
+#include "quiche/quic/core/io/connecting_client_socket.h"
 #include "quiche/quic/core/io/quic_event_loop.h"
 #include "quiche/quic/core/io/socket_factory.h"
-#include "quiche/quic/core/io/stream_client_socket.h"
 #include "quiche/quic/core/quic_types.h"
 #include "quiche/quic/platform/api/quic_socket_address.h"
 #include "quiche/common/platform/api/quiche_export.h"
@@ -26,10 +26,10 @@
                          quiche::QuicheBufferAllocator* buffer_allocator);
 
   // SocketFactory:
-  std::unique_ptr<StreamClientSocket> CreateTcpClientSocket(
+  std::unique_ptr<ConnectingClientSocket> CreateTcpClientSocket(
       const quic::QuicSocketAddress& peer_address,
       QuicByteCount receive_buffer_size, QuicByteCount send_buffer_size,
-      StreamClientSocket::AsyncVisitor* async_visitor) override;
+      ConnectingClientSocket::AsyncVisitor* async_visitor) override;
 
  private:
   QuicEventLoop* const event_loop_;                  // unowned
diff --git a/quiche/quic/core/io/event_loop_tcp_client_socket.h b/quiche/quic/core/io/event_loop_tcp_client_socket.h
index 2d50087..4d4e515 100644
--- a/quiche/quic/core/io/event_loop_tcp_client_socket.h
+++ b/quiche/quic/core/io/event_loop_tcp_client_socket.h
@@ -11,8 +11,8 @@
 #include "absl/strings/string_view.h"
 #include "absl/types/optional.h"
 #include "absl/types/variant.h"
+#include "quiche/quic/core/io/connecting_client_socket.h"
 #include "quiche/quic/core/io/quic_event_loop.h"
-#include "quiche/quic/core/io/stream_client_socket.h"
 #include "quiche/quic/core/quic_types.h"
 #include "quiche/quic/platform/api/quic_socket_address.h"
 #include "quiche/common/platform/api/quiche_export.h"
@@ -22,7 +22,7 @@
 
 // A TCP client socket implemented using an underlying QuicEventLoop.
 class QUICHE_EXPORT_PRIVATE EventLoopTcpClientSocket
-    : public StreamClientSocket,
+    : public ConnectingClientSocket,
       public QuicSocketEventListener {
  public:
   // Will use platform default buffer size if `receive_buffer_size` or
@@ -38,12 +38,10 @@
 
   ~EventLoopTcpClientSocket() override;
 
-  // StreamClientSocket:
+  // ConnectingClientSocket:
   absl::Status ConnectBlocking() override;
   void ConnectAsync() override;
   void Disconnect() override;
-
-  // Socket:
   absl::StatusOr<quiche::QuicheMemSlice> ReceiveBlocking(
       QuicByteCount max_size) override;
   void ReceiveAsync(QuicByteCount max_size) override;
diff --git a/quiche/quic/core/io/event_loop_tcp_client_socket_test.cc b/quiche/quic/core/io/event_loop_tcp_client_socket_test.cc
index f3c0800..cbf724e 100644
--- a/quiche/quic/core/io/event_loop_tcp_client_socket_test.cc
+++ b/quiche/quic/core/io/event_loop_tcp_client_socket_test.cc
@@ -15,11 +15,11 @@
 #include "absl/strings/string_view.h"
 #include "absl/types/optional.h"
 #include "absl/types/span.h"
+#include "quiche/quic/core/io/connecting_client_socket.h"
 #include "quiche/quic/core/io/event_loop_socket_factory.h"
 #include "quiche/quic/core/io/quic_default_event_loop.h"
 #include "quiche/quic/core/io/quic_event_loop.h"
 #include "quiche/quic/core/io/socket.h"
-#include "quiche/quic/core/io/stream_client_socket.h"
 #include "quiche/quic/core/quic_time.h"
 #include "quiche/quic/platform/api/quic_ip_address_family.h"
 #include "quiche/quic/platform/api/quic_socket_address.h"
@@ -128,7 +128,7 @@
 
 class EventLoopTcpClientSocketTest
     : public quiche::test::QuicheTestWithParam<QuicEventLoopFactory*>,
-      public StreamClientSocket::AsyncVisitor {
+      public ConnectingClientSocket::AsyncVisitor {
  public:
   void SetUp() override {
     QUICHE_CHECK(CreateListeningServerSocket(&server_socket_descriptor_,
@@ -181,7 +181,7 @@
                          &GetTestParamName);
 
 TEST_P(EventLoopTcpClientSocketTest, Connect) {
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/0,
@@ -195,7 +195,7 @@
 }
 
 TEST_P(EventLoopTcpClientSocketTest, ConnectAsync) {
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/0,
@@ -220,7 +220,7 @@
 }
 
 TEST_P(EventLoopTcpClientSocketTest, ErrorBeforeConnectAsync) {
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/0,
@@ -241,7 +241,7 @@
 }
 
 TEST_P(EventLoopTcpClientSocketTest, ErrorDuringConnectAsync) {
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/0,
@@ -268,7 +268,7 @@
 }
 
 TEST_P(EventLoopTcpClientSocketTest, Disconnect) {
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/0,
@@ -279,7 +279,7 @@
 }
 
 TEST_P(EventLoopTcpClientSocketTest, DisconnectCancelsConnectAsync) {
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/0,
@@ -302,7 +302,7 @@
 }
 
 TEST_P(EventLoopTcpClientSocketTest, ConnectAndReconnect) {
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/0,
@@ -332,7 +332,7 @@
   TestTcpServerSocketRunner runner(
       server_socket_descriptor_, absl::bind_front(&SendDataOnSocket, expected));
 
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/0,
@@ -352,7 +352,7 @@
 }
 
 TEST_P(EventLoopTcpClientSocketTest, ReceiveAsync) {
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/0,
@@ -396,7 +396,7 @@
 }
 
 TEST_P(EventLoopTcpClientSocketTest, DisconnectCancelsReceiveAsync) {
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/0,
@@ -438,7 +438,7 @@
       server_socket_descriptor_,
       absl::bind_front(&ReceiveDataFromSocket, &sent));
 
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/0,
@@ -456,7 +456,7 @@
 TEST_P(EventLoopTcpClientSocketTest, SendAsync) {
   // Use a small send buffer to improve chances of a send needing to be
   // asynchronous.
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/4,
@@ -497,7 +497,7 @@
 TEST_P(EventLoopTcpClientSocketTest, DisconnectCancelsSendAsync) {
   // Use a small send buffer to improve chances of a send needing to be
   // asynchronous.
-  std::unique_ptr<StreamClientSocket> socket =
+  std::unique_ptr<ConnectingClientSocket> socket =
       socket_factory_.CreateTcpClientSocket(server_socket_address_,
                                             /*receive_buffer_size=*/0,
                                             /*send_buffer_size=*/4,
diff --git a/quiche/quic/core/io/socket.h b/quiche/quic/core/io/socket.h
index fcc6418..a591723 100644
--- a/quiche/quic/core/io/socket.h
+++ b/quiche/quic/core/io/socket.h
@@ -16,7 +16,6 @@
 #include "quiche/quic/platform/api/quic_ip_address_family.h"
 #include "quiche/quic/platform/api/quic_socket_address.h"
 #include "quiche/common/platform/api/quiche_export.h"
-#include "quiche/common/platform/api/quiche_mem_slice.h"
 
 #if defined(_WIN32)
 #include <winsock2.h>
@@ -32,57 +31,6 @@
 inline constexpr SocketFd kInvalidSocketFd = -1;
 #endif
 
-// A read/write socket.
-//
-// Warning regarding blocking calls: Code in the QUICHE library typically
-// handles IO on a single thread, so if making calls from that typical
-// environment, it would be problematic to make a blocking call and block that
-// single thread.
-class QUICHE_EXPORT_PRIVATE Socket {
- public:
-  class AsyncVisitor {
-   public:
-    virtual ~AsyncVisitor() = default;
-
-    // If the operation completed without error, `data` is set to the received
-    // data.
-    virtual void ReceiveComplete(
-        absl::StatusOr<quiche::QuicheMemSlice> data) = 0;
-
-    virtual void SendComplete(absl::Status status) = 0;
-  };
-
-  virtual ~Socket() = default;
-
-  // Blocking read. Receives and returns a buffer of up to `max_size` bytes from
-  // socket. Returns status on error.
-  virtual absl::StatusOr<quiche::QuicheMemSlice> ReceiveBlocking(
-      QuicByteCount max_size) = 0;
-
-  // Asynchronous read. Receives up to `max_size` bytes from socket. If
-  // no data is synchronously available to be read, waits until some data is
-  // available or the socket is closed. On completion, calls ReceiveComplete()
-  // on the visitor, potentially before return from ReceiveAsync().
-  //
-  // After calling, the socket must not be destroyed until ReceiveComplete() is
-  // called.
-  virtual void ReceiveAsync(QuicByteCount max_size) = 0;
-
-  // Blocking write. Sends all of `data` (potentially via multiple underlying
-  // socket sends).
-  virtual absl::Status SendBlocking(std::string data) = 0;
-  virtual absl::Status SendBlocking(quiche::QuicheMemSlice data) = 0;
-
-  // Asynchronous write. Sends all of `data` (potentially via multiple
-  // underlying socket sends). On completion, calls SendComplete() on the
-  // visitor, potentially before return from SendAsync().
-  //
-  // After calling, the socket must not be destroyed until SendComplete() is
-  // called.
-  virtual void SendAsync(std::string data) = 0;
-  virtual void SendAsync(quiche::QuicheMemSlice data) = 0;
-};
-
 // Low-level platform-agnostic socket operations. Closely follows the behavior
 // of basic POSIX socket APIs, diverging mostly only to convert to/from cleaner
 // and platform-agnostic types.
diff --git a/quiche/quic/core/io/socket_factory.h b/quiche/quic/core/io/socket_factory.h
index 39102f1..36ea666 100644
--- a/quiche/quic/core/io/socket_factory.h
+++ b/quiche/quic/core/io/socket_factory.h
@@ -7,7 +7,7 @@
 
 #include <memory>
 
-#include "quiche/quic/core/io/stream_client_socket.h"
+#include "quiche/quic/core/io/connecting_client_socket.h"
 #include "quiche/quic/core/quic_types.h"
 #include "quiche/quic/platform/api/quic_socket_address.h"
 #include "quiche/common/platform/api/quiche_export.h"
@@ -23,10 +23,10 @@
   // `send_buffer_size` is zero. If `async_visitor` is null, async operations
   // must not be called on the created socket. If `async_visitor` is non-null,
   // it must outlive the created socket.
-  virtual std::unique_ptr<StreamClientSocket> CreateTcpClientSocket(
+  virtual std::unique_ptr<ConnectingClientSocket> CreateTcpClientSocket(
       const quic::QuicSocketAddress& peer_address,
       QuicByteCount receive_buffer_size, QuicByteCount send_buffer_size,
-      StreamClientSocket::AsyncVisitor* async_visitor) = 0;
+      ConnectingClientSocket::AsyncVisitor* async_visitor) = 0;
 };
 
 }  // namespace quic
diff --git a/quiche/quic/core/io/stream_client_socket.h b/quiche/quic/core/io/stream_client_socket.h
deleted file mode 100644
index 00f9a42..0000000
--- a/quiche/quic/core/io/stream_client_socket.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef QUICHE_QUIC_CORE_IO_STREAM_CLIENT_SOCKET_H_
-#define QUICHE_QUIC_CORE_IO_STREAM_CLIENT_SOCKET_H_
-
-#include "absl/status/status.h"
-#include "quiche/quic/core/io/socket.h"
-#include "quiche/common/platform/api/quiche_export.h"
-
-namespace quic {
-
-// A client socket using a protocol (typically TCP) that provides
-// connection-based streams.
-//
-// Must not destroy a connected/connecting socket. If connected or connecting,
-// must call Disconnect() to disconnect or cancel the connection before
-// destruction.
-//
-// Warning regarding blocking calls: Code in the QUICHE library typically
-// handles IO on a single thread, so if making calls from that typical
-// environment, it would be problematic to make a blocking call and block that
-// single thread.
-class QUICHE_EXPORT_PRIVATE StreamClientSocket : public Socket {
- public:
-  class AsyncVisitor : public Socket::AsyncVisitor {
-   public:
-    virtual void ConnectComplete(absl::Status status) = 0;
-  };
-
-  ~StreamClientSocket() override = default;
-
-  // Establishes a connection synchronously. Should not be called if socket has
-  // already been successfully connected without first calling Disconnect().
-  virtual absl::Status ConnectBlocking() = 0;
-
-  // Establishes a connection asynchronously. On completion, calls
-  // ConnectComplete() on the visitor, potentially before return from
-  // ConnectAsync(). Should not be called if socket has already been
-  // successfully connected without first calling Disconnect().
-  //
-  // After calling, the socket must not be destroyed until Disconnect() is
-  // called.
-  virtual void ConnectAsync() = 0;
-
-  // Disconnects a connected socket or cancels an in-progress ConnectAsync(),
-  // invoking the `ConnectComplete(absl::CancelledError())` on the visitor.
-  // After success, it is possible to call ConnectBlocking() or ConnectAsync()
-  // again to establish a new connection. Cancels any pending read or write
-  // operations, calling visitor completion methods with
-  // `absl::CancelledError()`.
-  //
-  // Typically implemented via a call to ::close(), which for TCP can result in
-  // either FIN or RST, depending on socket/platform state and undefined
-  // platform behavior.
-  virtual void Disconnect() = 0;
-};
-
-}  // namespace quic
-
-#endif  // QUICHE_QUIC_CORE_IO_STREAM_CLIENT_SOCKET_H_
diff --git a/quiche/quic/tools/connect_tunnel.h b/quiche/quic/tools/connect_tunnel.h
index 357a9d0..7cc9bbf 100644
--- a/quiche/quic/tools/connect_tunnel.h
+++ b/quiche/quic/tools/connect_tunnel.h
@@ -14,8 +14,8 @@
 #include "absl/status/status.h"
 #include "absl/status/statusor.h"
 #include "absl/strings/string_view.h"
+#include "quiche/quic/core/io/connecting_client_socket.h"
 #include "quiche/quic/core/io/socket_factory.h"
-#include "quiche/quic/core/io/stream_client_socket.h"
 #include "quiche/quic/core/quic_error_codes.h"
 #include "quiche/quic/core/quic_server_id.h"
 #include "quiche/quic/tools/quic_simple_server_backend.h"
@@ -25,7 +25,7 @@
 namespace quic {
 
 // Manages a single connection tunneled over a CONNECT proxy.
-class ConnectTunnel : public StreamClientSocket::AsyncVisitor {
+class ConnectTunnel : public ConnectingClientSocket::AsyncVisitor {
  public:
   // `client_stream_request_handler` and `socket_factory` must both outlive the
   // created ConnectTunnel.
@@ -53,7 +53,7 @@
   // interacted with after completion.
   void OnClientStreamClose();
 
-  // StreamClientSocket::AsyncVisitor:
+  // ConnectingClientSocket::AsyncVisitor:
   void ConnectComplete(absl::Status status) override;
   void ReceiveComplete(absl::StatusOr<quiche::QuicheMemSlice> data) override;
   void SendComplete(absl::Status status) override;
@@ -79,7 +79,7 @@
   QuicSimpleServerBackend::RequestHandler* client_stream_request_handler_;
 
   // Null when destination connection disconnected.
-  std::unique_ptr<StreamClientSocket> destination_socket_;
+  std::unique_ptr<ConnectingClientSocket> destination_socket_;
 
   bool receive_started_ = false;
 };
diff --git a/quiche/quic/tools/connect_tunnel_test.cc b/quiche/quic/tools/connect_tunnel_test.cc
index de569f3..4492c7a 100644
--- a/quiche/quic/tools/connect_tunnel_test.cc
+++ b/quiche/quic/tools/connect_tunnel_test.cc
@@ -12,8 +12,8 @@
 #include "absl/status/statusor.h"
 #include "absl/strings/str_cat.h"
 #include "absl/strings/string_view.h"
+#include "quiche/quic/core/io/connecting_client_socket.h"
 #include "quiche/quic/core/io/socket_factory.h"
-#include "quiche/quic/core/io/stream_client_socket.h"
 #include "quiche/quic/core/quic_connection_id.h"
 #include "quiche/quic/core/quic_error_codes.h"
 #include "quiche/quic/core/quic_types.h"
@@ -63,15 +63,15 @@
 
 class MockSocketFactory : public SocketFactory {
  public:
-  MOCK_METHOD(std::unique_ptr<StreamClientSocket>, CreateTcpClientSocket,
+  MOCK_METHOD(std::unique_ptr<ConnectingClientSocket>, CreateTcpClientSocket,
               (const quic::QuicSocketAddress& peer_address,
                QuicByteCount receive_buffer_size,
                QuicByteCount send_buffer_size,
-               StreamClientSocket::AsyncVisitor* async_visitor),
+               ConnectingClientSocket::AsyncVisitor* async_visitor),
               (override));
 };
 
-class MockSocket : public StreamClientSocket {
+class MockSocket : public ConnectingClientSocket {
  public:
   MOCK_METHOD(absl::Status, ConnectBlocking, (), (override));
   MOCK_METHOD(void, ConnectAsync, (), (override));