TEST_P(ProxyProtocolTest, V2LocalConnection) {
  // A 'local' connection, e.g. health-checking, no address, no extensions
  constexpr uint8_t buffer[] = {0x0d, 0x0a, 0x0d, 0x0a, 0x00, 0x0d, 0x0a, 0x51, 0x55,
                                0x49, 0x54, 0x0a, 0x20, 0x00, 0x00, 0x00, 'm',  'o',
                                'r',  'e',  ' ',  'd',  'a',  't',  'a'};
  connect();
  write(buffer, sizeof(buffer));
  expectData("more data");
  if (server_connection_->remoteAddress()->ip()->version() ==
      Envoy::Network::Address::IpVersion::v6) {
    EXPECT_EQ(server_connection_->remoteAddress()->ip()->addressAsString(), "::1");
  } else if (server_connection_->remoteAddress()->ip()->version() ==
             Envoy::Network::Address::IpVersion::v4) {
    EXPECT_EQ(server_connection_->remoteAddress()->ip()->addressAsString(), "127.0.0.1");
  }
  EXPECT_FALSE(server_connection_->localAddressRestored());
  disconnect();
}
TEST_P(ProxyProtocolTest, V2LocalConnection) {
   
  constexpr uint8_t buffer[] = {0x0d, 0x0a, 0x0d, 0x0a, 0x00, 0x0d, 0x0a, 0x51, 0x55,
                                0x49, 0x54, 0x0a, 0x20, 0x00, 0x00, 0x00, 'm',  'o',
                                'r',  'e',  ' ',  'd',  'a',  't',  'a'};
  connect();
  write(buffer, sizeof(buffer));
  expectData("more data");
  if (server_connection_->remoteAddress()->ip()->version() ==
      Envoy::Network::Address::IpVersion::v6) {
    EXPECT_EQ(server_connection_->remoteAddress()->ip()->addressAsString(), "::1");
  } else if (server_connection_->remoteAddress()->ip()->version() ==
             Envoy::Network::Address::IpVersion::v4) {
    EXPECT_EQ(server_connection_->remoteAddress()->ip()->addressAsString(), "127.0.0.1");
  }
  EXPECT_FALSE(server_connection_->localAddressRestored());
  disconnect();
}