You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2017/02/22 17:46:48 UTC

thrift git commit: THRIFT-3706: added cross test support for backwards compatible multiplexed server, added c_glib testBinary, fixed a number of glib object reference issues Client: c_glib, java

Repository: thrift
Updated Branches:
  refs/heads/master 4361ecc3a -> 37aac3bb5


THRIFT-3706: added cross test support for backwards compatible multiplexed server, added c_glib testBinary, fixed a number of glib object reference issues
Client: c_glib, java

This closes #1200


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/37aac3bb
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/37aac3bb
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/37aac3bb

Branch: refs/heads/master
Commit: 37aac3bb58b9a7413b25e5eba4fb95fc8796cd3c
Parents: 4361ecc
Author: James E. King, III <ji...@simplivity.com>
Authored: Tue Feb 21 14:01:09 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Wed Feb 22 12:46:04 2017 -0500

----------------------------------------------------------------------
 .../protocol/thrift_multiplexed_protocol.c      | 190 +++++------
 .../protocol/thrift_multiplexed_protocol.h      |   3 +-
 .../thrift/c_glib/protocol/thrift_protocol.c    |  41 ++-
 .../c_glib/protocol/thrift_protocol_decorator.c | 329 +++++++++----------
 .../c_glib/protocol/thrift_protocol_decorator.h |  15 +-
 .../src/thrift/c_glib/server/thrift_server.c    |  35 +-
 .../c_glib/transport/thrift_server_socket.c     |   4 +-
 .../c_glib/transport/thrift_server_socket.h     |   2 +-
 .../src/thrift/c_glib/transport/thrift_socket.c |  11 +-
 .../src/thrift/c_glib/transport/thrift_socket.h |   5 +-
 lib/c_glib/test/testcontainertest.c             |  15 +-
 .../test/org/apache/thrift/test/TestServer.java |  34 +-
 test/c_glib/src/test_client.c                   | 299 ++++++++++++-----
 test/tests.json                                 |  18 +-
 14 files changed, 561 insertions(+), 440 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
index 86f8097..dec4dbd 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
@@ -31,7 +31,6 @@
 enum
 {
   PROP_THRIFT_MULTIPLEXED_PROTOCOL_SERVICE_NAME = 1,
-  PROP_THRIFT_MULTIPLEXED_PROTOCOL_SEPARATOR,
   PROP_THRIFT_MULTIPLEXED_PROTOCOL_END
 };
 
@@ -42,114 +41,95 @@ static GParamSpec *thrift_multiplexed_protocol_obj_properties[PROP_THRIFT_MULTIP
 
 gint32
 thrift_multiplexed_protocol_write_message_begin (ThriftMultiplexedProtocol *protocol,
-		const gchar *name, const ThriftMessageType message_type,
-		const gint32 seqid, GError **error)
+    const gchar *name, const ThriftMessageType message_type,
+    const gint32 seqid, GError **error)
 {
-	gint32 ret;
-	gchar *service_name = NULL;
-	g_return_val_if_fail (THRIFT_IS_MULTIPLEXED_PROTOCOL (protocol), -1);
+  gint32 ret;
+  gchar *service_name = NULL;
+  g_return_val_if_fail (THRIFT_IS_MULTIPLEXED_PROTOCOL (protocol), -1);
 
-	ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL (protocol);
-	ThriftMultiplexedProtocolClass *multiplexClass = THRIFT_MULTIPLEXED_PROTOCOL_GET_CLASS(self);
-	ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (multiplexClass);
+  ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL (protocol);
+  ThriftMultiplexedProtocolClass *multiplexClass = THRIFT_MULTIPLEXED_PROTOCOL_GET_CLASS(self);
+  ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (multiplexClass);
 
-	if( (message_type == T_CALL || message_type == T_ONEWAY) && self->service_name != NULL) {
-		service_name = g_strdup_printf("%s%s%s", self->service_name, self->separator, name);
+  if( (message_type == T_CALL || message_type == T_ONEWAY) && self->service_name != NULL) {
+    service_name = g_strdup_printf("%s%s%s", self->service_name, THRIFT_MULTIPLEXED_PROTOCOL_DEFAULT_SEPARATOR, name);
+  }else{
+    service_name = g_strdup(name);
+  }
 
-	}else{
-		service_name = g_strdup(name);
-	}
+  // relay to the protocol_decorator
+  ret = thrift_protocol_decorator_write_message_begin(protocol, service_name, message_type, seqid, error);
 
-	// relay to the protocol_decorator
-	ret = thrift_protocol_decorator_write_message_begin(protocol, service_name, message_type, seqid, error);
+  g_free(service_name);
 
-	g_free(service_name);
-
-	return ret;
+  return ret;
 }
 
 
-
-
 static void
 thrift_multiplexed_protocol_set_property (GObject      *object,
-		guint         property_id,
-		const GValue *value,
-		GParamSpec   *pspec)
+    guint         property_id,
+    const GValue *value,
+    GParamSpec   *pspec)
 {
-	ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL (object);
-
-	switch (property_id)
-	{
-	case PROP_THRIFT_MULTIPLEXED_PROTOCOL_SERVICE_NAME:
-		if(self->service_name!=NULL)
-			g_free (self->service_name);
-		self->service_name= g_value_dup_string (value);
-		break;
-
-	case PROP_THRIFT_MULTIPLEXED_PROTOCOL_SEPARATOR:
-		if(self->separator!=NULL)
-			g_free (self->separator);
-		self->separator= g_value_dup_string (value);
-		break;
-
-	default:
-		/* We don't have any other property... */
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
+  ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL (object);
+
+  switch (property_id)
+  {
+  case PROP_THRIFT_MULTIPLEXED_PROTOCOL_SERVICE_NAME:
+    self->service_name = g_value_dup_string (value);
+    break;
+
+  default:
+    /* We don't have any other property... */
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    break;
+  }
 }
 
 static void
 thrift_multiplexed_protocol_get_property (GObject    *object,
-		guint       property_id,
-		GValue     *value,
-		GParamSpec *pspec)
+    guint       property_id,
+    GValue     *value,
+    GParamSpec *pspec)
 {
-	ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL (object);
-
-	switch (property_id)
-	{
-	case PROP_THRIFT_MULTIPLEXED_PROTOCOL_SERVICE_NAME:
-		g_value_set_string (value, self->service_name);
-		break;
-
-	case PROP_THRIFT_MULTIPLEXED_PROTOCOL_SEPARATOR:
-		g_value_set_string (value, self->separator);
-		break;
-
-	default:
-		/* We don't have any other property... */
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
+  ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL (object);
+
+  switch (property_id)
+  {
+  case PROP_THRIFT_MULTIPLEXED_PROTOCOL_SERVICE_NAME:
+    g_value_set_string (value, self->service_name);
+    break;
+
+  default:
+    /* We don't have any other property... */
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    break;
+  }
 }
 
 
 static void
 thrift_multiplexed_protocol_init (ThriftMultiplexedProtocol *protocol)
 {
-	//  THRIFT_UNUSED_VAR (protocol);
-	protocol->separator = g_strdup (THRIFT_MULTIPLEXED_PROTOCOL_DEFAULT_SEPARATOR);
-	protocol->service_name = NULL;
+  protocol->service_name = NULL;
 }
 
 static void
-thrift_multiplexed_protocol_finalize (ThriftMultiplexedProtocol *protocol)
+thrift_multiplexed_protocol_finalize (GObject *gobject)
 {
-	if(protocol->separator){
-		g_free(protocol->separator);
-		protocol->separator = NULL;
-	}
-	if(protocol->service_name){
-		g_free(protocol->service_name);
-		protocol->service_name = NULL;
-	}
-	/* Always chain up to the parent class; there is no need to check if
-	 * the parent class implements the dispose() virtual function: it is
-	 * always guaranteed to do so
-	 */
-	/* This fails, why? G_OBJECT_CLASS (protocol)->finalize(protocol); */
+  ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL (gobject);
+
+  if (self->service_name) {
+    g_free(self->service_name);
+    self->service_name = NULL;
+  }
+
+  /* Always chain up to the parent class; as with dispose(), finalize()
+   * is guaranteed to exist on the parent's class virtual function table
+   */
+  G_OBJECT_CLASS (thrift_multiplexed_protocol_parent_class)->finalize(gobject);
 }
 
 
@@ -157,31 +137,23 @@ thrift_multiplexed_protocol_finalize (ThriftMultiplexedProtocol *protocol)
 static void
 thrift_multiplexed_protocol_class_init (ThriftMultiplexedProtocolClass *klass)
 {
-	ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (klass);
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-	g_debug("Current Multiplexed write_message_begin addr %p, new %p", cls->write_message_begin, thrift_multiplexed_protocol_write_message_begin);
-	cls->write_message_begin = thrift_multiplexed_protocol_write_message_begin;
-
-
-	object_class->set_property = thrift_multiplexed_protocol_set_property;
-	object_class->get_property = thrift_multiplexed_protocol_get_property;
-	object_class->finalize = thrift_multiplexed_protocol_finalize;
-
-	thrift_multiplexed_protocol_obj_properties[PROP_THRIFT_MULTIPLEXED_PROTOCOL_SERVICE_NAME] =
-			g_param_spec_string ("service-name",
-					"Service name the protocol points to",
-					"Set the service name",
-					NULL /* default value */,
-					(G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
-	thrift_multiplexed_protocol_obj_properties[PROP_THRIFT_MULTIPLEXED_PROTOCOL_SEPARATOR] =
-			g_param_spec_string ("separator",
-					"Separator for service name and pointer",
-					"Set service name separator",
-					NULL /* default value */,
-					G_PARAM_READWRITE);
-
-	g_object_class_install_properties (object_class,
-			PROP_THRIFT_MULTIPLEXED_PROTOCOL_END,
-			thrift_multiplexed_protocol_obj_properties);
+  ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (klass);
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  cls->write_message_begin = thrift_multiplexed_protocol_write_message_begin;
+
+  object_class->set_property = thrift_multiplexed_protocol_set_property;
+  object_class->get_property = thrift_multiplexed_protocol_get_property;
+  object_class->finalize = thrift_multiplexed_protocol_finalize;
+
+  thrift_multiplexed_protocol_obj_properties[PROP_THRIFT_MULTIPLEXED_PROTOCOL_SERVICE_NAME] =
+      g_param_spec_string ("service-name",
+          "Service name the protocol points to",
+          "Set the service name",
+          NULL,
+          (G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+
+  g_object_class_install_properties (object_class,
+      PROP_THRIFT_MULTIPLEXED_PROTOCOL_END,
+      thrift_multiplexed_protocol_obj_properties);
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.h
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.h b/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.h
index 58d86ce..c6e08fb 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.h
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.h
@@ -41,7 +41,7 @@ G_BEGIN_DECLS
 #define THRIFT_IS_MULTIPLEXED_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_MULTIPLEXED_PROTOCOL))
 #define THRIFT_MULTIPLEXED_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_MULTIPLEXED_PROTOCOL, ThriftMultiplexedProtocolClass))
 
-/* version numbers */
+/* constant */
 #define THRIFT_MULTIPLEXED_PROTOCOL_DEFAULT_SEPARATOR ":"
 
 typedef struct _ThriftMultiplexedProtocol ThriftMultiplexedProtocol;
@@ -56,7 +56,6 @@ struct _ThriftMultiplexedProtocol
   ThriftProtocolDecorator parent;
 
   gchar *service_name;
-  gchar *separator;
 };
 
 typedef struct _ThriftMultiplexedProtocolClass ThriftMultiplexedProtocolClass;

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
index 8a560a9..1433725 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
@@ -61,15 +61,15 @@ thrift_protocol_set_property (GObject *object, guint property_id,
   switch (property_id)
   {
     case PROP_THRIFT_PROTOCOL_TRANSPORT:
-      protocol->transport = g_value_get_object (value);
+      protocol->transport = g_value_dup_object (value);
       break;
   }
 }
 
 
 gint32
-thrift_protocol_write_message_begin (ThriftProtocol *protocol, 
-                                     const gchar *name, 
+thrift_protocol_write_message_begin (ThriftProtocol *protocol,
+                                     const gchar *name,
                                      const ThriftMessageType message_type,
                                      const gint32 seqid, GError **error)
 {
@@ -243,7 +243,7 @@ thrift_protocol_write_binary (ThriftProtocol *protocol, const gpointer buf,
                                                              len, error);
 }
 
-gint32 
+gint32
 thrift_protocol_read_message_begin (ThriftProtocol *protocol,
                                     gchar **name,
                                     ThriftMessageType *message_type,
@@ -254,7 +254,7 @@ thrift_protocol_read_message_begin (ThriftProtocol *protocol,
                                                    seqid, error);
 }
 
-gint32 
+gint32
 thrift_protocol_read_message_end (ThriftProtocol *protocol,
                                   GError **error)
 {
@@ -262,7 +262,7 @@ thrift_protocol_read_message_end (ThriftProtocol *protocol,
                                                                  error);
 }
 
-gint32 
+gint32
 thrift_protocol_read_struct_begin (ThriftProtocol *protocol,
                                    gchar **name,
                                    GError **error)
@@ -279,7 +279,7 @@ thrift_protocol_read_struct_end (ThriftProtocol *protocol, GError **error)
                                                                 error);
 }
 
-gint32 
+gint32
 thrift_protocol_read_field_begin (ThriftProtocol *protocol,
                                   gchar **name,
                                   ThriftType *field_type,
@@ -293,7 +293,7 @@ thrift_protocol_read_field_begin (ThriftProtocol *protocol,
                                                                  error);
 }
 
-gint32 
+gint32
 thrift_protocol_read_field_end (ThriftProtocol *protocol,
                                 GError **error)
 {
@@ -301,7 +301,7 @@ thrift_protocol_read_field_end (ThriftProtocol *protocol,
                                                                error);
 }
 
-gint32 
+gint32
 thrift_protocol_read_map_begin (ThriftProtocol *protocol,
                                 ThriftType *key_type,
                                 ThriftType *value_type, guint32 *size,
@@ -311,17 +311,17 @@ thrift_protocol_read_map_begin (ThriftProtocol *protocol,
                                                                key_type,
                                                                value_type,
                                                                size,
-                                                               error); 
+                                                               error);
 }
 
-gint32 
+gint32
 thrift_protocol_read_map_end (ThriftProtocol *protocol, GError **error)
 {
   return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_map_end (protocol,
                                                              error);
 }
 
-gint32 
+gint32
 thrift_protocol_read_list_begin (ThriftProtocol *protocol,
                                  ThriftType *element_type,
                                  guint32 *size, GError **error)
@@ -412,7 +412,7 @@ thrift_protocol_read_string (ThriftProtocol *protocol,
 }
 
 gint32
-thrift_protocol_read_binary (ThriftProtocol *protocol, gpointer *buf, 
+thrift_protocol_read_binary (ThriftProtocol *protocol, gpointer *buf,
                              guint32 *len, GError **error)
 {
   return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_binary (protocol, buf,
@@ -549,12 +549,27 @@ thrift_protocol_init (ThriftProtocol *protocol)
 }
 
 static void
+thrift_protocol_dispose (GObject *gobject)
+{
+  ThriftProtocol *self = THRIFT_PROTOCOL (gobject);
+
+  g_clear_object(&self->transport);
+
+  /* Always chain up to the parent class; there is no need to check if
+   * the parent class implements the dispose() virtual function: it is
+   * always guaranteed to do so
+   */
+  G_OBJECT_CLASS (thrift_protocol_parent_class)->dispose(gobject);
+}
+
+static void
 thrift_protocol_class_init (ThriftProtocolClass *cls)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
 
   gobject_class->get_property = thrift_protocol_get_property;
   gobject_class->set_property = thrift_protocol_set_property;
+  gobject_class->dispose = thrift_protocol_dispose;
 
   g_object_class_install_property (gobject_class,
       PROP_THRIFT_PROTOCOL_TRANSPORT,

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
index 1844795..4480315 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
@@ -52,9 +52,9 @@ thrift_protocol_decorator_write_message_begin (ThriftProtocol *protocol,
   ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
   ThriftProtocolClass *proto = THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol);
 
-  g_info("Concrete protocol %p | %p", self->concrete_protocol, proto);
+  g_debug("Concrete protocol %p | %p", self->concrete_protocol, proto);
 
-  return proto->write_message_begin	(self->concrete_protocol, name,
+  return proto->write_message_begin (self->concrete_protocol, name,
                                     message_type, seqid,
                                     error);
 }
@@ -62,7 +62,7 @@ thrift_protocol_decorator_write_message_begin (ThriftProtocol *protocol,
 gint32
 thrift_protocol_decorator_write_message_end (ThriftProtocol *protocol, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_message_end (self->concrete_protocol,
                                                                   error);
@@ -72,7 +72,7 @@ gint32
 thrift_protocol_decorator_write_struct_begin (ThriftProtocol *protocol, const gchar *name,
                                     GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_struct_begin (self->concrete_protocol,
                                                    name, error);
@@ -81,7 +81,7 @@ thrift_protocol_decorator_write_struct_begin (ThriftProtocol *protocol, const gc
 gint32
 thrift_protocol_decorator_write_struct_end (ThriftProtocol *protocol, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_struct_end (self->concrete_protocol,
                                                                  error);
@@ -94,7 +94,7 @@ thrift_protocol_decorator_write_field_begin (ThriftProtocol *protocol,
                                    const gint16 field_id,
                                    GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_field_begin (self->concrete_protocol,
                                                    name, field_type,
                                                    field_id, error);
@@ -103,7 +103,7 @@ thrift_protocol_decorator_write_field_begin (ThriftProtocol *protocol,
 gint32
 thrift_protocol_decorator_write_field_end (ThriftProtocol *protocol, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_field_end (self->concrete_protocol,
                                                                 error);
@@ -112,7 +112,7 @@ thrift_protocol_decorator_write_field_end (ThriftProtocol *protocol, GError **er
 gint32
 thrift_protocol_decorator_write_field_stop (ThriftProtocol *protocol, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_field_stop (self->concrete_protocol,
                                                                  error);
@@ -124,7 +124,7 @@ thrift_protocol_decorator_write_map_begin (ThriftProtocol *protocol,
                                  const ThriftType value_type,
                                  const guint32 size, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_map_begin (self->concrete_protocol,
                                                    key_type, value_type,
@@ -134,7 +134,7 @@ thrift_protocol_decorator_write_map_begin (ThriftProtocol *protocol,
 gint32
 thrift_protocol_decorator_write_map_end (ThriftProtocol *protocol, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_map_end (self->concrete_protocol,
                                                               error);
@@ -145,7 +145,7 @@ thrift_protocol_decorator_write_list_begin (ThriftProtocol *protocol,
                                   const ThriftType element_type,
                                   const guint32 size, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_list_begin (self->concrete_protocol,
                                                    element_type, size,
@@ -155,7 +155,7 @@ thrift_protocol_decorator_write_list_begin (ThriftProtocol *protocol,
 gint32
 thrift_protocol_decorator_write_list_end (ThriftProtocol *protocol, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_list_end (self->concrete_protocol,
                                                                error);
@@ -166,7 +166,7 @@ thrift_protocol_decorator_write_set_begin (ThriftProtocol *protocol,
                                  const ThriftType element_type,
                                  const guint32 size, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_set_begin (self->concrete_protocol,
                                                    element_type, size,
@@ -176,7 +176,7 @@ thrift_protocol_decorator_write_set_begin (ThriftProtocol *protocol,
 gint32
 thrift_protocol_decorator_write_set_end (ThriftProtocol *protocol, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_set_end (self->concrete_protocol,
                                                               error);
@@ -186,7 +186,7 @@ gint32
 thrift_protocol_decorator_write_bool (ThriftProtocol *protocol,
                             const gboolean value, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_bool (self->concrete_protocol, value,
                                                            error);
@@ -196,7 +196,7 @@ gint32
 thrift_protocol_decorator_write_byte (ThriftProtocol *protocol, const gint8 value,
                             GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_byte (self->concrete_protocol, value,
                                                            error);
@@ -206,7 +206,7 @@ gint32
 thrift_protocol_decorator_write_i16 (ThriftProtocol *protocol, const gint16 value,
                            GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_i16 (self->concrete_protocol, value,
                                                           error);
@@ -216,7 +216,7 @@ gint32
 thrift_protocol_decorator_write_i32 (ThriftProtocol *protocol, const gint32 value,
                            GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_i32 (self->concrete_protocol, value,
                                                           error);
@@ -226,7 +226,7 @@ gint32
 thrift_protocol_decorator_write_i64 (ThriftProtocol *protocol, const gint64 value,
                            GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_i64 (self->concrete_protocol, value,
                                                           error);
@@ -236,7 +236,7 @@ gint32
 thrift_protocol_decorator_write_double (ThriftProtocol *protocol,
                               const gdouble value, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_double (self->concrete_protocol,
                                                              value, error);
@@ -246,7 +246,7 @@ gint32
 thrift_protocol_decorator_write_string (ThriftProtocol *protocol,
                               const gchar *str, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_string (self->concrete_protocol, str,
                                                              error);
@@ -256,7 +256,7 @@ gint32
 thrift_protocol_decorator_write_binary (ThriftProtocol *protocol, const gpointer buf,
                               const guint32 len, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->write_binary (self->concrete_protocol, buf,
                                                              len, error);
@@ -268,7 +268,7 @@ thrift_protocol_decorator_read_message_begin (ThriftProtocol *protocol,
                                     ThriftMessageType *message_type,
                                     gint32 *seqid, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_message_begin (self->concrete_protocol,
                                                    name, message_type,
@@ -279,7 +279,7 @@ gint32
 thrift_protocol_decorator_read_message_end (ThriftProtocol *protocol,
                                   GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_message_end (self->concrete_protocol,
                                                                  error);
@@ -290,7 +290,7 @@ thrift_protocol_decorator_read_struct_begin (ThriftProtocol *protocol,
                                    gchar **name,
                                    GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_struct_begin (self->concrete_protocol,
                                                                   name,
@@ -300,7 +300,7 @@ thrift_protocol_decorator_read_struct_begin (ThriftProtocol *protocol,
 gint32
 thrift_protocol_decorator_read_struct_end (ThriftProtocol *protocol, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_struct_end (self->concrete_protocol,
                                                                 error);
@@ -313,7 +313,7 @@ thrift_protocol_decorator_read_field_begin (ThriftProtocol *protocol,
                                   gint16 *field_id,
                                   GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_field_begin (self->concrete_protocol,
                                                                  name,
@@ -326,7 +326,7 @@ gint32
 thrift_protocol_decorator_read_field_end (ThriftProtocol *protocol,
                                 GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_field_end (self->concrete_protocol,
                                                                error);
@@ -338,7 +338,7 @@ thrift_protocol_decorator_read_map_begin (ThriftProtocol *protocol,
                                 ThriftType *value_type, guint32 *size,
                                 GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_map_begin (self->concrete_protocol,
                                                                key_type,
@@ -350,7 +350,7 @@ thrift_protocol_decorator_read_map_begin (ThriftProtocol *protocol,
 gint32
 thrift_protocol_decorator_read_map_end (ThriftProtocol *protocol, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_map_end (self->concrete_protocol,
                                                              error);
@@ -361,7 +361,7 @@ thrift_protocol_decorator_read_list_begin (ThriftProtocol *protocol,
                                  ThriftType *element_type,
                                  guint32 *size, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_list_begin (self->concrete_protocol,
                                                                 element_type,
@@ -371,7 +371,7 @@ thrift_protocol_decorator_read_list_begin (ThriftProtocol *protocol,
 gint32
 thrift_protocol_decorator_read_list_end (ThriftProtocol *protocol, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_list_end (self->concrete_protocol,
                                                               error);
@@ -382,7 +382,7 @@ thrift_protocol_decorator_read_set_begin (ThriftProtocol *protocol,
                                 ThriftType *element_type,
                                 guint32 *size, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_set_begin (self->concrete_protocol,
                                                                element_type,
@@ -392,7 +392,7 @@ thrift_protocol_decorator_read_set_begin (ThriftProtocol *protocol,
 gint32
 thrift_protocol_decorator_read_set_end (ThriftProtocol *protocol, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_set_end (self->concrete_protocol,
                                                              error);
@@ -402,7 +402,7 @@ gint32
 thrift_protocol_decorator_read_bool (ThriftProtocol *protocol, gboolean *value,
                            GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_bool (self->concrete_protocol, value,
                                                           error);
@@ -412,7 +412,7 @@ gint32
 thrift_protocol_decorator_read_byte (ThriftProtocol *protocol, gint8 *value,
                            GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_byte (self->concrete_protocol, value,
                                                           error);
@@ -422,7 +422,7 @@ gint32
 thrift_protocol_decorator_read_i16 (ThriftProtocol *protocol, gint16 *value,
                           GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_i16 (self->concrete_protocol, value,
                                                          error);
@@ -432,7 +432,7 @@ gint32
 thrift_protocol_decorator_read_i32 (ThriftProtocol *protocol, gint32 *value,
                           GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_i32 (self->concrete_protocol, value,
                                                          error);
@@ -442,7 +442,7 @@ gint32
 thrift_protocol_decorator_read_i64 (ThriftProtocol *protocol, gint64 *value,
                           GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_i64 (self->concrete_protocol, value,
                                                          error);
@@ -452,7 +452,7 @@ gint32
 thrift_protocol_decorator_read_double (ThriftProtocol *protocol,
                              gdouble *value, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_double (self->concrete_protocol, value,
                                                             error);
@@ -462,7 +462,7 @@ gint32
 thrift_protocol_decorator_read_string (ThriftProtocol *protocol,
                              gchar **str, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_string (self->concrete_protocol, str,
                                                             error);
@@ -472,7 +472,7 @@ gint32
 thrift_protocol_decorator_read_binary (ThriftProtocol *protocol, gpointer *buf,
                              guint32 *len, GError **error)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
 
   return THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol)->read_binary (self->concrete_protocol, buf,
                                                             len, error);
@@ -481,171 +481,146 @@ thrift_protocol_decorator_read_binary (ThriftProtocol *protocol, gpointer *buf,
 
 static void
 thrift_protocol_decorator_set_property (GObject      *object,
-		guint         property_id,
-		const GValue *value,
-		GParamSpec   *pspec)
-{
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (object);
-	g_info("Is protocol decorator %i", THRIFT_IS_PROTOCOL_DECORATOR(object));
-
-	switch (property_id)
-	{
-	case PROP_THRIFT_TYPE_PROTOCOL_DECORATOR_CONCRETE_PROTOCOL:
-		// FIXME We must finalize it first
-		//g_clear_object (&self->concrete_protocol);
-		self->concrete_protocol=g_value_get_pointer (value);
-		g_info("Setting concrete protocol %p to %p in %s",self,  self->concrete_protocol, g_type_name(G_TYPE_FROM_INSTANCE(object)));
-		// We must get the transport and set it on base class.
-
-		break;
-	default:
-		/* We don't have any other property... */
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
+    guint         property_id,
+    const GValue *value,
+    GParamSpec   *pspec)
+{
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (object);
+  g_debug("Is protocol decorator %i", THRIFT_IS_PROTOCOL_DECORATOR(object));
+
+  switch (property_id)
+  {
+  case PROP_THRIFT_TYPE_PROTOCOL_DECORATOR_CONCRETE_PROTOCOL:
+    self->concrete_protocol = g_value_dup_object (value);
+    g_debug("Setting concrete protocol %p to %p in %s", self, self->concrete_protocol, g_type_name(G_TYPE_FROM_INSTANCE(object)));
+    break;
+
+  default:
+    /* We don't have any other property... */
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    break;
+  }
 }
 
 static void
 thrift_protocol_decorator_get_property (GObject    *object,
-		guint       property_id,
-		GValue     *value,
-		GParamSpec *pspec)
+    guint       property_id,
+    GValue     *value,
+    GParamSpec *pspec)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (object);
-	g_info("Is protocol decorator %i", THRIFT_IS_PROTOCOL_DECORATOR(object));
-
-	switch (property_id)
-	{
-	case PROP_THRIFT_TYPE_PROTOCOL_DECORATOR_CONCRETE_PROTOCOL:
-		g_value_set_pointer (value, self->concrete_protocol);
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (object);
+  g_debug("Is protocol decorator %i", THRIFT_IS_PROTOCOL_DECORATOR(object));
 
-		/* But we must also set our */
+  switch (property_id)
+  {
+  case PROP_THRIFT_TYPE_PROTOCOL_DECORATOR_CONCRETE_PROTOCOL:
+    g_value_set_object (value, self->concrete_protocol);
+    break;
 
-		break;
-	default:
-		/* We don't have any other property... */
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
+  default:
+    /* We don't have any other property... */
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    break;
+  }
 }
 
 
 ThriftProtocol *
 thrift_protocol_decorator_get_concrete_protocol(ThriftProtocolDecorator *protocol)
 {
-	ThriftProtocol *retval = NULL;
-	if(!THRIFT_IS_PROTOCOL_DECORATOR(protocol)){
-		g_warning("The type is not protocol decorator");
-		return NULL;
-	}
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR(protocol);
-	g_info("Getting concrete protocol from %X -> %X", self, self->concrete_protocol);
+  ThriftProtocol *retval = NULL;
+  if(!THRIFT_IS_PROTOCOL_DECORATOR(protocol)){
+    g_warning("The type is not protocol decorator");
+    return NULL;
+  }
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR(protocol);
+  g_debug("Getting concrete protocol from %X -> %X", self, self->concrete_protocol);
 
-	return retval;
+  return retval;
 }
 
 
 static void
 thrift_protocol_decorator_init (ThriftProtocolDecorator *protocol)
 {
-	protocol->concrete_protocol = NULL;
+  protocol->concrete_protocol = NULL;
 }
 
-
-
 static void
-thrift_protocol_decorator_dispose (ThriftProtocolDecorator *protocol)
+thrift_protocol_decorator_dispose (GObject *gobject)
 {
-	ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
-
-	/* dispose() might be called multiple times, so we must guard against
-	   * calling g_object_unref() on an invalid GObject by setting the member
-	   * NULL; g_clear_object() does this for us.
-	   */
-	if(self->concrete_protocol!=NULL)
-		g_clear_object (&self->concrete_protocol);
-}
+  ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (gobject);
 
-static void
-thrift_protocol_decorator_finalize (ThriftProtocolDecorator *protocol)
-{
+  g_clear_object(&self->concrete_protocol);
 
-//	/*
-//	 * Chain the concrete protocol finalize
-//	 */
-//	if(protocol->concrete_protocol!=NULL){
-//		G_OBJECT_CLASS (protocol->concrete_protocol)->finalize(protocol->concrete_protocol);
-//	}
-	/* Always chain up to the parent class; there is no need to check if
-	 * the parent class implements the finalize() virtual function: it is
-	 * always guaranteed to do so
-	 */
-	G_OBJECT_CLASS (protocol)->finalize(protocol);
+  /* Always chain up to the parent class; there is no need to check if
+   * the parent class implements the dispose() virtual function: it is
+   * always guaranteed to do so
+   */
+  G_OBJECT_CLASS (thrift_protocol_decorator_parent_class)->dispose(gobject);
 }
 
 /* initialize the class */
 static void
 thrift_protocol_decorator_class_init (ThriftProtocolDecoratorClass *klass)
 {
-	ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (klass);
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	object_class->set_property = thrift_protocol_decorator_set_property;
-	object_class->get_property = thrift_protocol_decorator_get_property;
-	object_class->finalize = thrift_protocol_decorator_finalize;
-	object_class->dispose = thrift_protocol_decorator_dispose;
-
-	thrift_protocol_decorator_obj_properties[PROP_THRIFT_TYPE_PROTOCOL_DECORATOR_CONCRETE_PROTOCOL] =
-			g_param_spec_pointer ("protocol",
-					"Protocol",
-					"Set the protocol to be implemented",
-					(G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
-
-	g_object_class_install_properties (object_class,
-			PROP_THRIFT_TYPE_PROTOCOL_DECORATOR_END,
-			thrift_protocol_decorator_obj_properties);
-
-	g_info("Current decorator write_message_begin addr %p, new %p", cls->write_message_begin, thrift_protocol_decorator_write_message_begin);
-
-
-	  cls->write_message_begin = thrift_protocol_decorator_write_message_begin;
-	  cls->write_message_end = thrift_protocol_decorator_write_message_end;
-	  cls->write_struct_begin = thrift_protocol_decorator_write_struct_begin;
-	  cls->write_struct_end = thrift_protocol_decorator_write_struct_end;
-	  cls->write_field_begin = thrift_protocol_decorator_write_field_begin;
-	  cls->write_field_end = thrift_protocol_decorator_write_field_end;
-	  cls->write_field_stop = thrift_protocol_decorator_write_field_stop;
-	  cls->write_map_begin = thrift_protocol_decorator_write_map_begin;
-	  cls->write_map_end = thrift_protocol_decorator_write_map_end;
-	  cls->write_list_begin = thrift_protocol_decorator_write_list_begin;
-	  cls->write_list_end = thrift_protocol_decorator_write_list_end;
-	  cls->write_set_begin = thrift_protocol_decorator_write_set_begin;
-	  cls->write_set_end = thrift_protocol_decorator_write_set_end;
-	  cls->write_bool = thrift_protocol_decorator_write_bool;
-	  cls->write_byte = thrift_protocol_decorator_write_byte;
-	  cls->write_i16 = thrift_protocol_decorator_write_i16;
-	  cls->write_i32 = thrift_protocol_decorator_write_i32;
-	  cls->write_i64 = thrift_protocol_decorator_write_i64;
-	  cls->write_double = thrift_protocol_decorator_write_double;
-	  cls->write_string = thrift_protocol_decorator_write_string;
-	  cls->write_binary = thrift_protocol_decorator_write_binary;
-	  cls->read_message_begin = thrift_protocol_decorator_read_message_begin;
-	  cls->read_message_end = thrift_protocol_decorator_read_message_end;
-	  cls->read_struct_begin = thrift_protocol_decorator_read_struct_begin;
-	  cls->read_struct_end = thrift_protocol_decorator_read_struct_end;
-	  cls->read_field_begin = thrift_protocol_decorator_read_field_begin;
-	  cls->read_field_end = thrift_protocol_decorator_read_field_end;
-	  cls->read_map_begin = thrift_protocol_decorator_read_map_begin;
-	  cls->read_map_end = thrift_protocol_decorator_read_map_end;
-	  cls->read_list_begin = thrift_protocol_decorator_read_list_begin;
-	  cls->read_list_end = thrift_protocol_decorator_read_list_end;
-	  cls->read_set_begin = thrift_protocol_decorator_read_set_begin;
-	  cls->read_set_end = thrift_protocol_decorator_read_set_end;
-	  cls->read_bool = thrift_protocol_decorator_read_bool;
-	  cls->read_byte = thrift_protocol_decorator_read_byte;
-	  cls->read_i16 = thrift_protocol_decorator_read_i16;
-	  cls->read_i32 = thrift_protocol_decorator_read_i32;
-	  cls->read_i64 = thrift_protocol_decorator_read_i64;
-	  cls->read_double = thrift_protocol_decorator_read_double;
-	  cls->read_string = thrift_protocol_decorator_read_string;
-	  cls->read_binary = thrift_protocol_decorator_read_binary;
+  ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (klass);
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  object_class->set_property = thrift_protocol_decorator_set_property;
+  object_class->get_property = thrift_protocol_decorator_get_property;
+  object_class->dispose = thrift_protocol_decorator_dispose;
+
+  thrift_protocol_decorator_obj_properties[PROP_THRIFT_TYPE_PROTOCOL_DECORATOR_CONCRETE_PROTOCOL] =
+      g_param_spec_object ("protocol",
+          "Protocol",
+          "Set the protocol to be implemented", THRIFT_TYPE_PROTOCOL,
+          (G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+
+  g_object_class_install_properties (object_class,
+      PROP_THRIFT_TYPE_PROTOCOL_DECORATOR_END,
+      thrift_protocol_decorator_obj_properties);
+
+  g_debug("Current decorator write_message_begin addr %p, new %p", cls->write_message_begin, thrift_protocol_decorator_write_message_begin);
+
+  cls->write_message_begin = thrift_protocol_decorator_write_message_begin;
+  cls->write_message_end = thrift_protocol_decorator_write_message_end;
+  cls->write_struct_begin = thrift_protocol_decorator_write_struct_begin;
+  cls->write_struct_end = thrift_protocol_decorator_write_struct_end;
+  cls->write_field_begin = thrift_protocol_decorator_write_field_begin;
+  cls->write_field_end = thrift_protocol_decorator_write_field_end;
+  cls->write_field_stop = thrift_protocol_decorator_write_field_stop;
+  cls->write_map_begin = thrift_protocol_decorator_write_map_begin;
+  cls->write_map_end = thrift_protocol_decorator_write_map_end;
+  cls->write_list_begin = thrift_protocol_decorator_write_list_begin;
+  cls->write_list_end = thrift_protocol_decorator_write_list_end;
+  cls->write_set_begin = thrift_protocol_decorator_write_set_begin;
+  cls->write_set_end = thrift_protocol_decorator_write_set_end;
+  cls->write_bool = thrift_protocol_decorator_write_bool;
+  cls->write_byte = thrift_protocol_decorator_write_byte;
+  cls->write_i16 = thrift_protocol_decorator_write_i16;
+  cls->write_i32 = thrift_protocol_decorator_write_i32;
+  cls->write_i64 = thrift_protocol_decorator_write_i64;
+  cls->write_double = thrift_protocol_decorator_write_double;
+  cls->write_string = thrift_protocol_decorator_write_string;
+  cls->write_binary = thrift_protocol_decorator_write_binary;
+  cls->read_message_begin = thrift_protocol_decorator_read_message_begin;
+  cls->read_message_end = thrift_protocol_decorator_read_message_end;
+  cls->read_struct_begin = thrift_protocol_decorator_read_struct_begin;
+  cls->read_struct_end = thrift_protocol_decorator_read_struct_end;
+  cls->read_field_begin = thrift_protocol_decorator_read_field_begin;
+  cls->read_field_end = thrift_protocol_decorator_read_field_end;
+  cls->read_map_begin = thrift_protocol_decorator_read_map_begin;
+  cls->read_map_end = thrift_protocol_decorator_read_map_end;
+  cls->read_list_begin = thrift_protocol_decorator_read_list_begin;
+  cls->read_list_end = thrift_protocol_decorator_read_list_end;
+  cls->read_set_begin = thrift_protocol_decorator_read_set_begin;
+  cls->read_set_end = thrift_protocol_decorator_read_set_end;
+  cls->read_bool = thrift_protocol_decorator_read_bool;
+  cls->read_byte = thrift_protocol_decorator_read_byte;
+  cls->read_i16 = thrift_protocol_decorator_read_i16;
+  cls->read_i32 = thrift_protocol_decorator_read_i32;
+  cls->read_i64 = thrift_protocol_decorator_read_i64;
+  cls->read_double = thrift_protocol_decorator_read_double;
+  cls->read_string = thrift_protocol_decorator_read_string;
+  cls->read_binary = thrift_protocol_decorator_read_binary;
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.h
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.h b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.h
index 8eb6bac..13b6af2 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.h
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.h
@@ -44,34 +44,29 @@ typedef struct _ThriftProtocolDecorator ThriftProtocolDecorator;
 
 
 /*!
- * Thrift Multiplexed Protocol instance.
+ * Thrift Protocol Decorator instance.
  */
 struct _ThriftProtocolDecorator
 {
-	ThriftProtocol parent;
+  ThriftProtocol parent;
 
-	ThriftProtocol *concrete_protocol;
+  ThriftProtocol *concrete_protocol;
 };
 
 typedef struct _ThriftProtocolDecoratorClass ThriftProtocolDecoratorClass;
 
 /*!
- * Thrift Multiplexed Protocol class.
+ * Thrift Protocol Decorator class.
  */
 struct _ThriftProtocolDecoratorClass
 {
-	ThriftProtocolClass parent;
+  ThriftProtocolClass parent;
 
 };
 
 /* used by THRIFT_TYPE_PROTOCOL_DECORATOR */
 GType thrift_protocol_decorator_get_type (void);
 
-
-ThriftProtocol *
-thrift_protocol_decorator_get_concrete_protocol(ThriftProtocolDecorator *protocol);
-
-
 G_END_DECLS
 
 #endif /* _THRIFT_PROTOCOL_DECORATOR_H */

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/c_glib/src/thrift/c_glib/server/thrift_server.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/server/thrift_server.c b/lib/c_glib/src/thrift/c_glib/server/thrift_server.c
index e8aff45..ccf9153 100644
--- a/lib/c_glib/src/thrift/c_glib/server/thrift_server.c
+++ b/lib/c_glib/src/thrift/c_glib/server/thrift_server.c
@@ -76,22 +76,22 @@ thrift_server_set_property (GObject *object, guint property_id,
   switch (property_id)
   {
     case PROP_THRIFT_SERVER_PROCESSOR:
-      server->processor = g_value_get_object (value);
+      server->processor = g_value_dup_object (value);
       break;
     case PROP_THRIFT_SERVER_SERVER_TRANSPORT:
-      server->server_transport = g_value_get_object (value);
+      server->server_transport = g_value_dup_object (value);
       break;
     case PROP_THRIFT_SERVER_INPUT_TRANSPORT_FACTORY:
-      server->input_transport_factory = g_value_get_object (value);
+      server->input_transport_factory = g_value_dup_object (value);
       break;
     case PROP_THRIFT_SERVER_OUTPUT_TRANSPORT_FACTORY:
-      server->output_transport_factory = g_value_get_object (value);
+      server->output_transport_factory = g_value_dup_object (value);
       break;
     case PROP_THRIFT_SERVER_INPUT_PROTOCOL_FACTORY:
-      server->input_protocol_factory = g_value_get_object (value);
+      server->input_protocol_factory = g_value_dup_object (value);
       break;
     case PROP_THRIFT_SERVER_OUTPUT_PROTOCOL_FACTORY:
-      server->output_protocol_factory = g_value_get_object (value);
+      server->output_protocol_factory = g_value_dup_object (value);
       break;
   }
 }
@@ -120,7 +120,27 @@ thrift_server_init (ThriftServer *server)
   server->output_protocol_factory = NULL;
 }
 
-/* class initializer for ThriftServer
+static void
+thrift_server_dispose (GObject *gobject)
+{
+  ThriftServer *self = THRIFT_SERVER (gobject);
+
+  g_clear_object(&self->output_protocol_factory);
+  g_clear_object(&self->input_protocol_factory);
+  g_clear_object(&self->output_transport_factory);
+  g_clear_object(&self->input_transport_factory);
+  g_clear_object(&self->server_transport);
+  g_clear_object(&self->processor);
+
+  /* Always chain up to the parent class; there is no need to check if
+   * the parent class implements the dispose() virtual function: it is
+   * always guaranteed to do so
+   */
+  G_OBJECT_CLASS (thrift_server_parent_class)->dispose(gobject);
+}
+
+/*
+ * class initializer for ThriftServer
  * TODO: implement ServerEventHandler as a GClosure
  */
 static void
@@ -130,6 +150,7 @@ thrift_server_class_init (ThriftServerClass *cls)
 
   gobject_class->get_property = thrift_server_get_property;
   gobject_class->set_property = thrift_server_set_property;
+  gobject_class->dispose = thrift_server_dispose;
 
   g_object_class_install_property (gobject_class,
       PROP_THRIFT_SERVER_PROCESSOR,

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.c
index 6fc6ab3..6ea897c 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.c
@@ -224,12 +224,12 @@ thrift_server_socket_class_init (ThriftServerSocketClass *cls)
                                   "port (construct)",
                                   "Set the port to listen to",
                                   0, /* min */
-                                  65534, /* max */
+                                  65535, /* max */
                                   9090, /* default by convention */
                                   G_PARAM_CONSTRUCT_ONLY |
                                   G_PARAM_READWRITE);
   g_object_class_install_property (gobject_class,
-                                   PROP_THRIFT_SERVER_SOCKET_PORT, 
+                                   PROP_THRIFT_SERVER_SOCKET_PORT,
                                    param_spec);
 
   param_spec = g_param_spec_uint ("backlog",

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.h
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.h b/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.h
index f072cb0..fd04954 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.h
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_server_socket.h
@@ -49,7 +49,7 @@ struct _ThriftServerSocket
   ThriftServerTransport parent;
 
   /* private */
-  gshort port;
+  guint port;
   gshort backlog;
   int sd;
   guint8 *buf;

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c
index 07ee2cb..ce6b344 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c
@@ -129,7 +129,7 @@ thrift_socket_open (ThriftTransport *transport, GError **error)
   memset (&pin, 0, sizeof(pin));
   pin.sin_family = AF_INET;
   pin.sin_addr.s_addr = ((struct in_addr *) (hp->h_addr))->s_addr;
-  pin.sin_port = htons (tsocket->port); 
+  pin.sin_port = htons (tsocket->port);
 
   /* create the socket */
   if ((tsocket->sd = socket (AF_INET, SOCK_STREAM, 0)) == -1)
@@ -210,7 +210,7 @@ thrift_socket_read_end (ThriftTransport *transport, GError **error)
 
 /* implements thrift_transport_write */
 gboolean
-thrift_socket_write (ThriftTransport *transport, const gpointer buf,     
+thrift_socket_write (ThriftTransport *transport, const gpointer buf,
                      const guint32 len, GError **error)
 {
   gint ret = 0;
@@ -315,6 +315,9 @@ thrift_socket_set_property (GObject *object, guint property_id,
   switch (property_id)
   {
     case PROP_THRIFT_SOCKET_HOSTNAME:
+      if (socket->hostname) {
+        g_free(socket->hostname);
+      }
       socket->hostname = g_strdup (g_value_get_string (value));
       break;
     case PROP_THRIFT_SOCKET_PORT:
@@ -347,8 +350,8 @@ thrift_socket_class_init (ThriftSocketClass *cls)
   param_spec = g_param_spec_uint ("port",
                                   "port (construct)",
                                   "Set the port of the remote host",
-                                  0, /* min */
-                                  65534, /* max */
+                                  0u, /* min */
+                                  65535u, /* max */
                                   9090, /* default by convention */
                                   G_PARAM_CONSTRUCT_ONLY |
                                   G_PARAM_READWRITE);

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.h
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.h b/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.h
index 981577d..2f6f67d 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.h
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.h
@@ -50,11 +50,8 @@ struct _ThriftSocket
 
   /* private */
   gchar *hostname;
-  gshort port;
+  guint port;
   int sd;
-  guint8 *buf;
-  guint32 buf_size;
-  guint32 buf_len;
 };
 
 typedef struct _ThriftSocketClass ThriftSocketClass;

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/c_glib/test/testcontainertest.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testcontainertest.c b/lib/c_glib/test/testcontainertest.c
index 1cbc55c..5fc51d5 100644
--- a/lib/c_glib/test/testcontainertest.c
+++ b/lib/c_glib/test/testcontainertest.c
@@ -512,13 +512,12 @@ main(int argc, char *argv[])
                                        THRIFT_SERVER_SOCKET_ERROR_ACCEPT));
 
     /* Free our resources */
-    g_object_unref (server);
-    g_object_unref (transport_factory);
-    g_object_unref (protocol_factory);
-    g_object_unref (server_transport);
-
-    g_object_unref (processor);
-    g_object_unref (handler);
+    g_clear_object (&server);
+    g_clear_object (&protocol_factory);
+    g_clear_object (&transport_factory);
+    g_clear_object (&server_transport);
+    g_clear_object (&processor);
+    g_clear_object (&handler);
 
     /* Wait for the child process to complete and return its exit status */
     g_assert (wait (&status) == pid);
@@ -527,4 +526,4 @@ main(int argc, char *argv[])
 
     return exit_status;
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/lib/java/test/org/apache/thrift/test/TestServer.java
----------------------------------------------------------------------
diff --git a/lib/java/test/org/apache/thrift/test/TestServer.java b/lib/java/test/org/apache/thrift/test/TestServer.java
index f4defad..71b86c3 100644
--- a/lib/java/test/org/apache/thrift/test/TestServer.java
+++ b/lib/java/test/org/apache/thrift/test/TestServer.java
@@ -64,8 +64,11 @@ public class TestServer {
   //
   // For multiplexed testing we always use binary protocol underneath.
   //
-  // "ThriftTest" named service implements ThriftTest from ThriftTest.thrift
-  // "Second" named service implements "SecondService" from ThriftTest.thrift
+  // "ThriftTest" named service implements "ThriftTest" from ThriftTest.thrift
+  // "SecondService" named service implements "SecondService" from ThriftTest.thrift
+  // In addition, to support older non-multiplexed clients using the same concrete protocol
+  // the multiplexed processor is taught to use "ThriftTest" if the incoming request has no
+  // multiplexed call name decoration.
 
   static class SecondHandler implements thrift.test.SecondService.Iface {
 
@@ -160,7 +163,7 @@ public class TestServer {
             System.out.println("  --help\t\t\tProduce help message");
             System.out.println("  --port=arg (=" + port + ")\tPort number to connect");
             System.out.println("  --transport=arg (=" + transport_type + ")\n\t\t\t\tTransport: buffered, framed, fastframed");
-            System.out.println("  --protocol=arg (=" + protocol_type + ")\tProtocol: binary, compact, json, multiplexed");
+            System.out.println("  --protocol=arg (=" + protocol_type + ")\tProtocol: binary, compact, json, multi, multic, multij");
             System.out.println("  --ssl\t\t\tEncrypted Transport using SSL");
             System.out.println("  --server-type=arg (=" + server_type +")\n\t\t\t\tType of server: simple, thread-pool, nonblocking, threaded-selector");
             System.out.println("  --string-limit=arg (=" + string_limit + ")\tString read length limit");
@@ -190,7 +193,9 @@ public class TestServer {
         if (protocol_type.equals("binary")) {
         } else if (protocol_type.equals("compact")) {
         } else if (protocol_type.equals("json")) {
-        } else if (protocol_type.equals("multiplexed")) {
+        } else if (protocol_type.equals("multi")) {
+        } else if (protocol_type.equals("multic")) {
+        } else if (protocol_type.equals("multij")) {
         } else {
           throw new Exception("Unknown protocol type! " + protocol_type);
         }
@@ -214,11 +219,11 @@ public class TestServer {
 
       // Protocol factory
       TProtocolFactory tProtocolFactory = null;
-      if (protocol_type.equals("json")) {
+      if (protocol_type.equals("json") || protocol_type.equals("multij")) {
         tProtocolFactory = new TJSONProtocol.Factory();
-      } else if (protocol_type.equals("compact")) {
+      } else if (protocol_type.equals("compact") || protocol_type.equals("multic")) {
         tProtocolFactory = new TCompactProtocol.Factory(string_limit, container_limit);
-      } else { // also covers multiplexed
+      } else { // also covers multi
         tProtocolFactory = new TBinaryProtocol.Factory(string_limit, container_limit);
       }
 
@@ -236,8 +241,9 @@ public class TestServer {
 
       // If we are multiplexing services in one server...
       TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor();
+      multiplexedProcessor.registerDefault  (testProcessor);
       multiplexedProcessor.registerProcessor("ThriftTest", testProcessor);
-      multiplexedProcessor.registerProcessor("Second", secondProcessor);
+      multiplexedProcessor.registerProcessor("SecondService", secondProcessor);
 
       if (server_type.equals("nonblocking") ||
           server_type.equals("threaded-selector")) {
@@ -249,7 +255,7 @@ public class TestServer {
           // Nonblocking Server
           TNonblockingServer.Args tNonblockingServerArgs
               = new TNonblockingServer.Args(tNonblockingServerSocket);
-          tNonblockingServerArgs.processor(protocol_type.equals("multiplexed") ? multiplexedProcessor : testProcessor);
+          tNonblockingServerArgs.processor(protocol_type.startsWith("multi") ? multiplexedProcessor : testProcessor);
           tNonblockingServerArgs.protocolFactory(tProtocolFactory);
           tNonblockingServerArgs.transportFactory(tTransportFactory);
           serverEngine = new TNonblockingServer(tNonblockingServerArgs);
@@ -257,7 +263,7 @@ public class TestServer {
           // ThreadedSelector Server
           TThreadedSelectorServer.Args tThreadedSelectorServerArgs
               = new TThreadedSelectorServer.Args(tNonblockingServerSocket);
-          tThreadedSelectorServerArgs.processor(protocol_type.equals("multiplexed") ? multiplexedProcessor : testProcessor);
+          tThreadedSelectorServerArgs.processor(protocol_type.startsWith("multi") ? multiplexedProcessor : testProcessor);
           tThreadedSelectorServerArgs.protocolFactory(tProtocolFactory);
           tThreadedSelectorServerArgs.transportFactory(tTransportFactory);
           serverEngine = new TThreadedSelectorServer(tThreadedSelectorServerArgs);
@@ -276,7 +282,7 @@ public class TestServer {
         if (server_type.equals("simple")) {
           // Simple Server
           TServer.Args tServerArgs = new TServer.Args(tServerSocket);
-          tServerArgs.processor(protocol_type.equals("multiplexed") ? multiplexedProcessor : testProcessor);
+          tServerArgs.processor(protocol_type.startsWith("multi") ? multiplexedProcessor : testProcessor);
           tServerArgs.protocolFactory(tProtocolFactory);
           tServerArgs.transportFactory(tTransportFactory);
           serverEngine = new TSimpleServer(tServerArgs);
@@ -284,7 +290,7 @@ public class TestServer {
           // ThreadPool Server
           TThreadPoolServer.Args tThreadPoolServerArgs
               = new TThreadPoolServer.Args(tServerSocket);
-          tThreadPoolServerArgs.processor(protocol_type.equals("multiplexed") ? multiplexedProcessor : testProcessor);
+          tThreadPoolServerArgs.processor(protocol_type.startsWith("multi") ? multiplexedProcessor : testProcessor);
           tThreadPoolServerArgs.protocolFactory(tProtocolFactory);
           tThreadPoolServerArgs.transportFactory(tTransportFactory);
           serverEngine = new TThreadPoolServer(tThreadPoolServerArgs);
@@ -295,7 +301,9 @@ public class TestServer {
       serverEngine.setServerEventHandler(new TestServerEventHandler());
 
       // Run it
-      System.out.println("Starting the server on port " + port + "...");
+      System.out.println("Starting the " + (ssl ? "ssl server" : "server") +
+        " [" + protocol_type + "/" + transport_type + "/" + server_type + "] on " +
+        ((domain_socket == "") ? ("port " + port) : ("unix socket " + domain_socket)));
       serverEngine.serve();
 
     } catch (Exception x) {

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/test/c_glib/src/test_client.c
----------------------------------------------------------------------
diff --git a/test/c_glib/src/test_client.c b/test/c_glib/src/test_client.c
index a6ef869..deff4e1 100644
--- a/test/c_glib/src/test_client.c
+++ b/test/c_glib/src/test_client.c
@@ -35,6 +35,7 @@
 #include <thrift/c_glib/transport/thrift_socket.h>
 #include <thrift/c_glib/transport/thrift_transport.h>
 
+#include "../gen-c_glib/t_test_second_service.h"
 #include "../gen-c_glib/t_test_thrift_test.h"
 
 /* Handle SIGPIPE signals (indicating the server has closed the
@@ -75,29 +76,36 @@ gint32_compare (gconstpointer a, gconstpointer b)
 }
 
 /**
- * It gets a multiplexed protocol which uses binary underneath
+ * It gets a multiplexed protocol which uses a concrete protocol underneath
+ * @param  protocol_name  the fully qualified protocol path (e.g. "binary:multi")
  * @param  transport      the underlying transport
  * @param  service_name   the single supported service name
  * @todo                  need to allow multiple services to fully test multiplexed
  * @return                a multiplexed protocol wrapping the correct underlying protocol
  */
 ThriftProtocol *
-get_multiplexed_protocol(ThriftTransport *transport, gchar *service_name)
+get_multiplexed_protocol(gchar *protocol_name, ThriftTransport *transport, gchar *service_name)
 {
-  ThriftProtocol * result_protocol=NULL;
-  ThriftProtocol * multiplexed_protocol=NULL;
-
-  multiplexed_protocol = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL,
-               "transport", transport,
-               NULL);
+  ThriftProtocol * multiplexed_protocol = NULL;
+
+  if ( strncmp(protocol_name, "binary:", 7) == 0) {
+    multiplexed_protocol = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL,
+                 "transport", transport,
+                 NULL);
+  } else if ( strncmp(protocol_name, "compact:", 8) == 0) {
+    multiplexed_protocol = g_object_new (THRIFT_TYPE_COMPACT_PROTOCOL,
+                 "transport", transport,
+                 NULL);
+  } else {
+    fprintf(stderr, "Unknown multiplex protocol name: %s\n", protocol_name);
+    return NULL;
+  }
 
-  result_protocol = g_object_new (THRIFT_TYPE_MULTIPLEXED_PROTOCOL,
-          "transport",  transport,
-          "protocol",   multiplexed_protocol,
+  return g_object_new (THRIFT_TYPE_MULTIPLEXED_PROTOCOL,
+          "transport",      transport,
+          "protocol",       multiplexed_protocol,
           "service-name",   service_name,
           NULL);
-
-  return result_protocol;
 }
 
 int
@@ -121,7 +129,7 @@ main (int argc, char **argv)
     { "transport",       't', 0, G_OPTION_ARG_STRING,   &transport_option,
       "Transport: buffered, framed (=buffered)", NULL },
     { "protocol",        'r', 0, G_OPTION_ARG_STRING,   &protocol_option,
-      "Protocol: binary, compact, multiplexed (=binary)", NULL },
+      "Protocol: binary, compact, multi, multic (=binary)", NULL },
     { "testloops",       'n', 0, G_OPTION_ARG_INT,      &num_tests,
       "Number of tests (=1)", NULL },
     { NULL }
@@ -136,11 +144,13 @@ main (int argc, char **argv)
   GType  protocol_type  = THRIFT_TYPE_BINARY_PROTOCOL;
   gchar *protocol_name  = "binary";
 
-  ThriftSocket    *socket;
-  ThriftTransport *transport;
-  ThriftProtocol  *protocol;
+  ThriftSocket    *socket = NULL;
+  ThriftTransport *transport = NULL;
+  ThriftProtocol  *protocol = NULL;
+  ThriftProtocol  *protocol2 = NULL;            // for multiplexed tests
 
-  TTestThriftTestIf *test_client;
+  TTestThriftTestIf *test_client = NULL;
+  TTestSecondServiceIf *second_service = NULL;  // for multiplexed tests
 
   struct timeval time_start, time_stop, time_elapsed;
   guint64 time_elapsed_usec, time_total_usec = 0;
@@ -180,12 +190,16 @@ main (int argc, char **argv)
       protocol_type = THRIFT_TYPE_COMPACT_PROTOCOL;
       protocol_name = "compact";
     }
-    else if (strncmp (protocol_option, "multiplexed", 12) == 0) {
+    else if (strncmp (protocol_option, "multi", 6) == 0) {
       protocol_type = THRIFT_TYPE_MULTIPLEXED_PROTOCOL;
-      protocol_name = "multiplexed(binary)";
+      protocol_name = "binary:multi";
+    }
+    else if (strncmp (protocol_option, "multic", 7) == 0) {
+      protocol_type = THRIFT_TYPE_MULTIPLEXED_PROTOCOL;
+      protocol_name = "compact:multic";
     }
     else if (strncmp (protocol_option, "binary", 7) == 0) {
-      printf("We are going with default binary protocol");
+      printf("We are going with default protocol\n");
     }
     else {
       fprintf (stderr, "Unknown protocol type %s\n", protocol_option);
@@ -240,7 +254,7 @@ main (int argc, char **argv)
 
   if (ssl && !thrift_ssl_load_cert_from_file(THRIFT_SSL_SOCKET(socket), "../keys/CA.pem")) {
     fprintf(stderr, "Unable to load validation certificate ../keys/CA.pem - did you run in the test/c_glib directory?\n");
-    g_object_unref (socket);
+    g_clear_object (&socket);
     return 253;
   }
 
@@ -252,17 +266,26 @@ main (int argc, char **argv)
     // TODO: A multiplexed test should also test "Second" (see Java TestServer)
     // The context comes from the name of the thrift file. If multiple thrift
     // schemas are used we have to redo the way this is done.
-    protocol = get_multiplexed_protocol(transport, "ThriftTest");
+    protocol = get_multiplexed_protocol(protocol_name, transport, "ThriftTest");
     if (NULL == protocol) {
-      g_object_unref (transport);
-      g_object_unref (socket);
+      g_clear_object (&transport);
+      g_clear_object (&socket);
       return 252;
     }
+
+    // Make a second protocol and client running on the same multiplexed transport
+    protocol2 = get_multiplexed_protocol(protocol_name, transport, "SecondService");
+    second_service = g_object_new (T_TEST_TYPE_SECOND_SERVICE_CLIENT,
+                                "input_protocol",  protocol2,
+                                "output_protocol", protocol2,
+                                NULL);
+
   }else{
     protocol = g_object_new (protocol_type,
            "transport", transport,
            NULL);
   }
+
   test_client = g_object_new (T_TEST_TYPE_THRIFT_TEST_CLIENT,
                               "input_protocol",  protocol,
                               "output_protocol", protocol,
@@ -348,11 +371,11 @@ main (int argc, char **argv)
         printf (" = void\n");
       }
       else {
-  if(error!=NULL){
-        printf ("%s\n", error->message);
-    g_error_free (error);
-    error = NULL;
-  }
+        if(error!=NULL){
+          printf ("%s\n", error->message);
+          g_error_free (error);
+          error = NULL;
+        }
         fail_count++;
       }
 
@@ -380,6 +403,31 @@ main (int argc, char **argv)
       }
 
       /**
+       * Multiplexed Test - do this right in the middle of the normal Test Client run
+       */
+      if (second_service) {
+        printf ("testSecondServiceMultiplexSecondTestString(\"2nd\")");
+        if (t_test_second_service_if_secondtest_string (second_service,
+                                                        &string,
+                                                        "2nd",
+                                                        &error)) {
+          printf (" = \"%s\"\n", string);
+          if (strncmp (string, "testString(\"2nd\")", 18) != 0) {
+            ++fail_count;
+          }
+
+          g_free (string);
+          string = NULL;
+        } else {
+          printf ("%s\n", error->message);
+          g_error_free (error);
+          error = NULL;
+
+          ++fail_count;
+        }
+      }
+
+      /**
        * BOOL TEST
        */
       printf ("testByte(true)");
@@ -511,7 +559,104 @@ main (int argc, char **argv)
         fail_count++;
       }
 
-      // TODO: add testBinary()
+      /**
+       * BINARY TEST
+       */
+      printf ("testBinary(empty)");
+      GByteArray *emptyArray = g_byte_array_new();
+      GByteArray *result = NULL;
+      if (t_test_thrift_test_if_test_binary (test_client,
+                                             &result,
+                                             emptyArray,
+                                             &error)) {
+        GBytes *response = g_byte_array_free_to_bytes(result);  // frees result
+        result = NULL;
+        gsize siz = g_bytes_get_size(response);
+        if (siz == 0) {
+          printf(" = empty\n");
+        } else {
+          printf(" = not empty (%ld bytes)\n", (long)siz);
+          ++fail_count;
+        }
+        g_bytes_unref(response);
+      } else {
+        printf ("%s\n", error->message);
+        g_error_free (error);
+        error = NULL;
+
+        fail_count++;
+      }
+      g_byte_array_unref(emptyArray);
+      emptyArray = NULL;
+
+      // TODO: add testBinary() with data
+      printf ("testBinary([-128..127]) = {");
+      const signed char bin_data[256]
+        = {-128, -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, -116, -115, -114,
+           -113, -112, -111, -110, -109, -108, -107, -106, -105, -104, -103, -102, -101, -100, -99,
+           -98,  -97,  -96,  -95,  -94,  -93,  -92,  -91,  -90,  -89,  -88,  -87,  -86,  -85,  -84,
+           -83,  -82,  -81,  -80,  -79,  -78,  -77,  -76,  -75,  -74,  -73,  -72,  -71,  -70,  -69,
+           -68,  -67,  -66,  -65,  -64,  -63,  -62,  -61,  -60,  -59,  -58,  -57,  -56,  -55,  -54,
+           -53,  -52,  -51,  -50,  -49,  -48,  -47,  -46,  -45,  -44,  -43,  -42,  -41,  -40,  -39,
+           -38,  -37,  -36,  -35,  -34,  -33,  -32,  -31,  -30,  -29,  -28,  -27,  -26,  -25,  -24,
+           -23,  -22,  -21,  -20,  -19,  -18,  -17,  -16,  -15,  -14,  -13,  -12,  -11,  -10,  -9,
+           -8,   -7,   -6,   -5,   -4,   -3,   -2,   -1,   0,    1,    2,    3,    4,    5,    6,
+           7,    8,    9,    10,   11,   12,   13,   14,   15,   16,   17,   18,   19,   20,   21,
+           22,   23,   24,   25,   26,   27,   28,   29,   30,   31,   32,   33,   34,   35,   36,
+           37,   38,   39,   40,   41,   42,   43,   44,   45,   46,   47,   48,   49,   50,   51,
+           52,   53,   54,   55,   56,   57,   58,   59,   60,   61,   62,   63,   64,   65,   66,
+           67,   68,   69,   70,   71,   72,   73,   74,   75,   76,   77,   78,   79,   80,   81,
+           82,   83,   84,   85,   86,   87,   88,   89,   90,   91,   92,   93,   94,   95,   96,
+           97,   98,   99,   100,  101,  102,  103,  104,  105,  106,  107,  108,  109,  110,  111,
+           112,  113,  114,  115,  116,  117,  118,  119,  120,  121,  122,  123,  124,  125,  126,
+           127};
+      GByteArray *fullArray = g_byte_array_new();
+      g_byte_array_append(fullArray, (guint8 *)(&bin_data[0]), 256);
+      if (t_test_thrift_test_if_test_binary (test_client,
+                                             &result,
+                                             fullArray,
+                                             &error)) {
+        GBytes *response = g_byte_array_free_to_bytes(result);  // frees result
+        result = NULL;
+        gsize siz = g_bytes_get_size(response);
+        gconstpointer ptr = g_bytes_get_data(response, &siz);
+        if (siz == 256) {
+          gboolean first = 1;
+          gboolean failed = 0;
+          int i;
+
+          for (i = 0; i < 256; ++i) {
+            if (!first)
+              printf(",");
+            else
+              first = 0;
+            int val = ((signed char *)ptr)[i];
+            printf("%d", val);
+            if (!failed && val != i - 128) {
+              failed = 1;
+            }
+          }
+          printf("} ");
+          if (failed) {
+            printf("FAIL (bad content) size %ld OK\n", (long)siz);
+            ++fail_count;
+          } else {
+            printf("OK size %ld OK\n", (long)siz);
+          }
+        } else {
+          printf(" = bad size %ld\n", (long)siz);
+          ++fail_count;
+        }
+        g_bytes_unref(response);
+      } else {
+        printf ("%s\n", error->message);
+        g_error_free (error);
+        error = NULL;
+
+        fail_count++;
+      }
+      g_byte_array_unref(fullArray);
+      fullArray = NULL;
 
       /**
        * STRUCT TEST
@@ -546,6 +691,11 @@ main (int argc, char **argv)
             i32_thing != -3 ||
             i64_thing != (gint64)-5)
           fail_count++;
+
+        if (string) {
+          g_free (string);
+          string = NULL;
+        }
       }
       else {
         printf ("%s\n", error->message);
@@ -554,7 +704,8 @@ main (int argc, char **argv)
 
         fail_count++;
       }
-      g_object_unref (xtruct_in);
+      // g_clear_object(&xtruct_out); used below
+      g_clear_object(&xtruct_in);
 
       /**
        * NESTED STRUCT TEST
@@ -597,6 +748,11 @@ main (int argc, char **argv)
             inner_i64_thing != (gint64)-5 ||
             i32_thing != 5)
           fail_count++;
+
+        if (string) {
+          g_free(string);
+          string = NULL;
+        }
       }
       else {
         printf ("%s\n", error->message);
@@ -606,10 +762,10 @@ main (int argc, char **argv)
         fail_count++;
       }
 
-      g_object_unref (xtruct_in);
-      g_object_unref (xtruct2_in);
-      g_object_unref (xtruct2_out);
-      g_object_unref (xtruct_out);
+      g_clear_object(&xtruct_in);
+      g_clear_object(&xtruct2_in);
+      g_clear_object(&xtruct2_out);
+      g_clear_object(&xtruct_out);
 
       /**
        * MAP TEST
@@ -1352,7 +1508,7 @@ main (int argc, char **argv)
       }
 
       g_hash_table_unref (map_in);
-      g_object_unref (insanity_out);
+      g_clear_object (&insanity_out);
 
       /* test exception */
       printf ("testClient.testException(\"Xception\") =>");
@@ -1368,8 +1524,7 @@ main (int argc, char **argv)
         printf ("  {%u, \"%s\"}\n", int32, string);
         g_free (string);
 
-        g_object_unref (xception);
-        xception = NULL;
+        g_clear_object (&xception);
 
         g_error_free (error);
         error = NULL;
@@ -1405,10 +1560,7 @@ main (int argc, char **argv)
         printf ("  void\nFAILURE\n");
         fail_count++;
 
-        if (xception != NULL) {
-          g_object_unref (xception);
-          xception = NULL;
-        }
+        g_clear_object (&xception);
 
         if (error != NULL) {
           g_error_free (error);
@@ -1426,10 +1578,7 @@ main (int argc, char **argv)
         printf ("  void\nFAILURE\n");
         fail_count++;
 
-        if (xception != NULL) {
-          g_object_unref (xception);
-          xception = NULL;
-        }
+        g_clear_object (&xception);
 
         g_error_free (error);
         error = NULL;
@@ -1466,15 +1615,8 @@ main (int argc, char **argv)
         printf ("  result\nFAILURE\n");
         fail_count++;
 
-        if (xception != NULL) {
-          g_object_unref (xception);
-          xception = NULL;
-        }
-
-        if (xception2 != NULL) {
-          g_object_unref (xception2);
-          xception = NULL;
-        }
+        g_clear_object (&xception);
+        g_clear_object (&xception2);
 
         if (error != NULL) {
           g_error_free (error);
@@ -1504,11 +1646,8 @@ main (int argc, char **argv)
         printf ("  {%u, {\"%s\"}}\n", int32, string);
         g_free (string);
 
-        g_object_unref (inner_xtruct_in);
-        inner_xtruct_in = NULL;
-
-        g_object_unref (xception2);
-        xception2 = NULL;
+        g_clear_object (&inner_xtruct_in);
+        g_clear_object (&xception2);
 
         g_error_free (error);
         error = NULL;
@@ -1517,22 +1656,15 @@ main (int argc, char **argv)
         printf ("  result\nFAILURE\n");
         fail_count++;
 
-        if (xception != NULL) {
-          g_object_unref (xception);
-          xception = NULL;
-        }
-
-        if (xception2 != NULL) {
-          g_object_unref (xception2);
-          xception = NULL;
-        }
+        g_clear_object (&xception);
+        g_clear_object (&xception2);
 
         if (error != NULL) {
           g_error_free (error);
           error = NULL;
         }
       }
-      g_object_unref (xtruct_in);
+      g_clear_object (&xtruct_in);
 
       printf ("testClient.testMultiException(\"success\", \"test 3\") =>");
       xtruct_in = g_object_new (T_TEST_TYPE_XTRUCT, NULL);
@@ -1555,22 +1687,15 @@ main (int argc, char **argv)
         printf ("  result\nFAILURE\n");
         fail_count++;
 
-        if (xception != NULL) {
-          g_object_unref (xception);
-          xception = NULL;
-        }
-
-        if (xception2 != NULL) {
-          g_object_unref (xception2);
-          xception = NULL;
-        }
+        g_clear_object (&xception);
+        g_clear_object (&xception2);
 
         if (error != NULL) {
           g_error_free (error);
           error = NULL;
         }
       }
-      g_object_unref (xtruct_in);
+      g_clear_object (&xtruct_in);
 
       /* test oneway void */
       printf ("testClient.testOneway(1) =>");
@@ -1647,7 +1772,6 @@ main (int argc, char **argv)
     }
     else {
       printf ("Connect failed: %s\n", error->message);
-      g_object_unref (socket);
       g_error_free (error);
       error = NULL;
 
@@ -1657,6 +1781,7 @@ main (int argc, char **argv)
 
   /* All done---output statistics */
   puts ("\nAll tests done.");
+  printf("Number of failures: %d\n", fail_count);
 
   time_avg_usec = time_total_usec / num_tests;
 
@@ -1664,10 +1789,12 @@ main (int argc, char **argv)
   printf ("Max time: %" PRIu64 " us\n", time_max_usec);
   printf ("Avg time: %" PRIu64 " us\n", time_avg_usec);
 
-  g_object_unref (test_client);
-  g_object_unref (protocol);
-  g_object_unref (transport);
-  g_free (host);
+  g_clear_object(&second_service);
+  g_clear_object(&protocol2);
+  g_clear_object(&test_client);
+  g_clear_object(&protocol);
+  g_clear_object(&transport);
+  g_clear_object(&socket);
 
   if (ssl) {
     thrift_ssl_socket_finalize_openssl();

http://git-wip-us.apache.org/repos/asf/thrift/blob/37aac3bb/test/tests.json
----------------------------------------------------------------------
diff --git a/test/tests.json b/test/tests.json
index 2ab2e1d..7e9cbf7 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -6,15 +6,20 @@
     ],
     "server": {
       "command": [
-        "test_server"
+        "test_server",
+        "--lt-debug"
       ]
     },
     "client": {
       "command": [
-        "test_client"
+        "test_client",
+        "--lt-debug"
       ],
       "protocols": [
-        "multiplexed"
+        "multi",
+        "multic",
+        "multi:binary",
+        "multic:compact"
       ],
       "sockets": [
         "ip-ssl"
@@ -111,7 +116,12 @@
       "delay": 10,
       "extra_args": ["run-testserver"],
       "protocols": [
-        "multiplexed"
+        "binary:multi",
+        "compact:multic",
+        "json:multij",
+        "multi",
+        "multic",
+        "multij"
       ]
     },
     "client": {