diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c
index 3ae6095..9bf8daa 100644
--- a/gio/tests/gdbus-peer.c
+++ b/gio/tests/gdbus-peer.c
@@ -42,8 +42,14 @@
 #include <sys/socket.h>
 #endif
 
-#include "gdbus-tests.h"
+#include <stdlib.h>
 
+/* used in test_overflow */
+#ifdef G_OS_UNIX
+#include <gio/gunixconnection.h>
+#endif
+
+#include "gdbus-tests.h"
 
 #ifdef G_OS_UNIX
 static gboolean is_unix = TRUE;
@@ -1246,6 +1252,109 @@ test_credentials (void)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
+#ifdef G_OS_UNIX
+static void
+test_overflow (void)
+{
+  gint sv[2];
+  GSocket *socket;
+  GSocketConnection *socket_connection;
+  GDBusConnection *connection;
+  GError *error;
+  gchar *guid;
+  pid_t child;
+
+  g_assert_cmpint (socketpair (AF_UNIX, SOCK_STREAM, 0, sv), ==, 0);
+
+  switch ((child = fork ()))
+    {
+    case -1:
+      g_assert_not_reached ();
+      break;
+
+    case 0:
+      /* child */
+      g_assert_cmpint (close (sv[0]), ==, 0); /* close other end */
+      error = NULL;
+      socket = g_socket_new_from_fd (sv[1], &error);
+      g_assert_no_error (error);
+      socket_connection = g_socket_connection_factory_create_connection (socket);
+      g_assert (socket_connection != NULL);
+      g_object_unref (socket);
+      guid = g_dbus_generate_guid ();
+      connection = g_dbus_connection_new_sync (G_IO_STREAM (socket_connection),
+                                               guid,
+                                               G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER,
+                                               NULL, /* GDBusAuthObserver */
+                                               NULL,
+                                               &error);
+      g_free (guid);
+      g_assert_no_error (error);
+      g_object_unref (socket_connection);
+
+      g_main_loop_run (loop);
+
+      g_object_unref (connection);
+      exit (0);
+      break;
+
+    default:
+      /* parent continues below */
+      break;
+    }
+
+  /* parent */
+  g_assert_cmpint (close (sv[1]), ==, 0); /* close other end */
+  error = NULL;
+  socket = g_socket_new_from_fd (sv[0], &error);
+  g_assert_no_error (error);
+  socket_connection = g_socket_connection_factory_create_connection (socket);
+  g_assert (socket_connection != NULL);
+  g_object_unref (socket);
+  connection = g_dbus_connection_new_sync (G_IO_STREAM (socket_connection),
+                                           NULL, /* guid */
+                                           G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+                                           NULL, /* GDBusAuthObserver */
+                                           NULL,
+                                           &error);
+  g_assert_no_error (error);
+  g_object_unref (socket_connection);
+
+  /* OK, stop the child */
+  g_assert_cmpint (kill (child, SIGSTOP), ==, 0);
+
+  g_dbus_connection_set_exit_on_close (connection, TRUE);
+
+  while (TRUE)
+    {
+      error = NULL;
+      g_dbus_connection_emit_signal (connection,
+                                     NULL, /* destination */
+                                     "/org/foo/Object",
+                                     "org.foo.Interface",
+                                     "Member",
+                                     g_variant_new ("(s)", "a string"),
+                                     &error);
+      /* run the main event loop - otherwise GDBusConnection::closed won't be fired */
+      g_main_context_iteration (NULL, FALSE);
+      //g_assert_no_error (error);
+      static gint count = 0;
+      g_print ("%d ", count++);
+    }
+
+  g_object_unref (connection);
+
+  g_assert_cmpint (kill (child, SIGTERM), ==, 0);
+}
+#else
+static void
+test_overflow (void)
+{
+}
+#endif
+
+/* ---------------------------------------------------------------------------------------------------- */
+
 int
 main (int   argc,
       char *argv[])
@@ -1270,6 +1379,7 @@ main (int   argc,
   g_test_add_func ("/gdbus/delayed-message-processing", delayed_message_processing);
   g_test_add_func ("/gdbus/nonce-tcp", test_nonce_tcp);
   g_test_add_func ("/gdbus/credentials", test_credentials);
+  g_test_add_func ("/gdbus/overflow", test_overflow);
 
   ret = g_test_run();
 
