@Override
      public void run() {
        try {
          BufferedInputStream in = new BufferedInputStream(connectionSocket.getInputStream());
          while (true) {

            byte[] streamNameByteSize = loadData(in, new byte[4]);
            ByteBuffer sizeBuf = ByteBuffer.wrap(streamNameByteSize);
            int streamNameSize = sizeBuf.getInt();
            byte[] streamNameData = loadData(in, new byte[streamNameSize]);
            String streamId = new String(streamNameData, 0, streamNameData.length);
            StreamRuntimeInfo streamRuntimeInfo = streamRuntimeInfoMap.get(streamId);

            Object[] eventData = new Object[streamRuntimeInfo.getNoOfAttributes()];
            byte[] fixedMessageData =
                loadData(in, new byte[8 + streamRuntimeInfo.getFixedMessageSize()]);

            ByteBuffer bbuf = ByteBuffer.wrap(fixedMessageData, 0, fixedMessageData.length);
            long timestamp = bbuf.getLong();

            List<Integer> stringValueSizes = new ArrayList<>();
            Attribute.Type[] attributeTypes = streamRuntimeInfo.getAttributeTypes();
            for (int i = 0; i < attributeTypes.length; i++) {
              Attribute.Type type = attributeTypes[i];
              switch (type) {
                case INT:
                  eventData[i] = bbuf.getInt();
                  continue;
                case LONG:
                  eventData[i] = bbuf.getLong();
                  continue;
                case BOOL:
                  eventData[i] = bbuf.get() == 1;
                  continue;
                case FLOAT:
                  eventData[i] = bbuf.getFloat();
                  continue;
                case DOUBLE:
                  eventData[i] = bbuf.getDouble();
                  continue;
                case STRING:
                  int size = bbuf.getInt();
                  stringValueSizes.add(size);
              }
            }

            int stringSizePosition = 0;
            for (int i = 0; i < attributeTypes.length; i++) {
              Attribute.Type type = attributeTypes[i];
              if (Attribute.Type.STRING == type) {
                byte[] stringData =
                    loadData(in, new byte[stringValueSizes.get(stringSizePosition)]);
                stringSizePosition++;
                eventData[i] = new String(stringData, 0, stringData.length);
              }
            }
            streamCallback.receive(streamId, timestamp, eventData);
          }
        } catch (EOFException e) {
          log.info("Closing listener socket. " + e.getMessage());
        } catch (IOException e) {
          log.error("Error reading data from receiver socket:" + e.getMessage(), e);
        } catch (Throwable t) {
          log.error("Error :" + t.getMessage(), t);
        }
      }
      @Override
      public void run() {
        try {
          if (connectionCallback != null) {
            connectionCallback.onPublisherBoltConnect();
          }
          BufferedInputStream in = new BufferedInputStream(connectionSocket.getInputStream());
          while (true) {

            byte[] streamNameByteSize = loadData(in, new byte[4]);
            ByteBuffer sizeBuf = ByteBuffer.wrap(streamNameByteSize);
            int streamNameSize = sizeBuf.getInt();
            if (streamNameSize == TCPEventPublisher.PING_HEADER_VALUE) {
              continue;
            }
            byte[] streamNameData = loadData(in, new byte[streamNameSize]);
            String streamId = new String(streamNameData, 0, streamNameData.length);
            StreamRuntimeInfo streamRuntimeInfo = streamRuntimeInfoMap.get(streamId);
            while (streamRuntimeInfo == null) {
              Thread.sleep(1000);
              log.warn(
                  "TCP server on port :'"
                      + tcpEventServerConfig.getPort()
                      + "' waiting for streamId:'"
                      + streamId
                      + "' to process incoming events");
              streamRuntimeInfo = streamRuntimeInfoMap.get(streamId);
            }
            Object[] eventData = new Object[streamRuntimeInfo.getNoOfAttributes()];
            byte[] fixedMessageData =
                loadData(in, new byte[8 + streamRuntimeInfo.getFixedMessageSize()]);

            ByteBuffer bbuf = ByteBuffer.wrap(fixedMessageData, 0, fixedMessageData.length);
            long timestamp = bbuf.getLong();

            List<Integer> stringValueSizes = new ArrayList<>();
            Attribute.Type[] attributeTypes = streamRuntimeInfo.getAttributeTypes();
            for (int i = 0; i < attributeTypes.length; i++) {
              Attribute.Type type = attributeTypes[i];
              switch (type) {
                case INT:
                  eventData[i] = bbuf.getInt();
                  continue;
                case LONG:
                  eventData[i] = bbuf.getLong();
                  continue;
                case BOOL:
                  eventData[i] = bbuf.get() == 1;
                  continue;
                case FLOAT:
                  eventData[i] = bbuf.getFloat();
                  continue;
                case DOUBLE:
                  eventData[i] = bbuf.getDouble();
                  continue;
                case STRING:
                  int size = bbuf.getInt();
                  stringValueSizes.add(size);
              }
            }

            int stringSizePosition = 0;
            for (int i = 0; i < attributeTypes.length; i++) {
              Attribute.Type type = attributeTypes[i];
              if (Attribute.Type.STRING == type) {
                byte[] stringData =
                    loadData(in, new byte[stringValueSizes.get(stringSizePosition)]);
                stringSizePosition++;
                eventData[i] = new String(stringData, 0, stringData.length);
              }
            }
            streamCallback.receive(streamId, timestamp, eventData);
          }
        } catch (EOFException e) {
          log.info("Closing listener socket. " + e.getMessage());
        } catch (IOException e) {
          log.error("Error reading data from receiver socket:" + e.getMessage(), e);
        } catch (Throwable t) {
          log.error("Error :" + t.getMessage(), t);
        } finally {
          if (connectionCallback != null) {
            connectionCallback.onPublisherBoltDisconnect();
          }
        }
      }