private void ConnectedClassic(IAsyncResult asyncResult)
        {
            _baseSock.EndConnect(asyncResult);

            // -- Create our Wrapped socket.
            _stream = new MinecraftStream(new NetworkStream(_baseSock), NetworkMode);

            // -- Subscribe to DataReceived event.
            OnDataReceived += HandlePacketClassic;

            // -- Begin data reading.
            _stream.BeginRead(new byte[0], 0, 0, PacketReceiverClassicAsync, null);
        }
        private IAsyncResult WriteFunction(IPacket packet)
        {
            using (var ms = new MemoryStream())
            using (var stream = new MinecraftStream(ms, Mode))
            {
                packet.WritePacket(stream);
                var data = ms.ToArray();

                switch (Mode)
                {
                    case NetworkMode.Modern:
                        if (ModernCompressionEnabled)
                            return BeginWriteWithCompression(data, null, null);
                        else
                            return BeginWriteWithoutCompression(data, null, null);

                    case NetworkMode.Classic:
                        return BeginWriteClassic(data, null, null);
                }
            }

            return null;
        }